<img src="images/Story/menu.png" width=80%>
<i><h3>
The following game is a work of fiction. Destined to Ascend is a game with a lot of erotic content.
Are you over legal age and friendly with the content of that game?</h3></i>
<<link "Yes" "Opening and Name">><<set $knownRecipes.push($strengthboostrecipe1)>><<set $difficulty to null>><</link>>
<a href="https://www.google.com/">No</a>
<<nobr>>
<<set $skillInventory.push($soulflareReversal)>>
<<set $skillInventory.push($stoneheartConstitution)>>
<<set $skillInventory.push($heavenSplittingPalm)>>
<</nobr>><div class="main-menu-container">
<h2 class="main-title">Path of Ascension</h2>
<div class="progress-hint">
<<if $mainStageStarted neq "true">>
<p>You are still wandering the mortal world.<br>
<strong>Explore the map</strong> and seek your destiny.</p>
<<elseif $CurrentPcMainSect is "">>
<p>Your foundation is laid, but you walk alone.<br>
<strong>Seek out a sect</strong> to join a greater path.</p>
<<elseif $CurrentPcSectRank in ["Initiate", "Disciple", "Inner Disciple"]>>
<p>You have entered <<print $CurrentPcMainSect>>, but your standing is low.<br>
<strong>Rise through the ranks</strong> - become a Core or True Disciple.</p>
<<else>>
<p>You are a <<print $CurrentPcSectRank>> of <<print $CurrentPcMainSect>>.<br>
<strong>Await word from your master</strong> - greater trials approach.</p>
<</if>>
</div>
<<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<<else>>
<i>I should probably put some clothes on ...</i>
<</if>></div><<nobr>>
<<if $pe eq 0>>
<br><img src="images/Story/intro.jpg" class=center width="60%">
<<run Dialog.setup("Movement & Skills")>>
<<run Dialog.wiki("You can move around the map using <b>WASD</b> keys.<br><br> Before engaging in battles, make sure to equip your skills! After you finish the prologue, open the <b>Skills</b> tab (bottom of the screen) to prepare your abilities.")>>
<<run Dialog.open()>>
<br>The wind howled like a crying ghost as dusk fell over the broken ridges of Mount Yunsu. You had come here chasing whispers—rumors of spirit beasts and hidden herbs—but found something far beyond the mundane.
<br>
<br>From behind a cluster of jagged boulders, you watched in awe and terror as two figures clashed mid-air—one cloaked in black flame, the other wrapped in blinding golden radiance. Swords hummed with killing intent, Qi tore through the sky, and even the clouds trembled. A battle between cultivators of opposing sects: one clearly righteous, the other reeking of demonic aura.
<br>
<br>As the duel reached its climax, the heavens themselves roared.
<br>
<br>Suddenly, the sky darkened. Black thunderclouds surged, lightning coiling like serpents. A blinding pillar of light struck between them, forcing both to crash to the earth. And from that split in the heavens… something impossible emerged.
<br>
<br>A mythical dragon, scaled in starlight and shadow, descended with a roar that shook your soul. The cultivators, powerful as they were, stood no chance. Their bodies, burned and bloodied, now lie in the clearing before you—half-dead, half-conscious. Their swords broken, their treasures scattered, their pride shattered.
<br>
<br>And now… they are within your reach.
<br>
<br>Observe [[righteous cultivator->Intro][$pe=2]] / [[demonic cultivator->Intro][$pe=3]]
<br>Help [[righteous cultivator->Intro][$pe=4]] / [[demonic cultivator->Intro][$pe=5]]
<br>Kill [[righteous cultivator->Intro][$pe=6]] / [[demonic cultivator->Intro][$pe=7]]
<<set $hasHelped to null>>
<<set $helpGiven to null>>
<<set $hasKilled1 to null>>
<<set $hasKilled2 to null>>
<<elseif $pe eq 2>>
<<if $hasKilled1 eq 1>><<else>><img src="images/Story/intro1.jpg" class=center width="60%">
<br>You approach the wounded woman wrapped in white robes. Despite the blood crusted on her lips and the scorched symbols along her sleeves, her aura still pulses with a righteous glow. A badge lies near her hand—<b>Clear Sky Azure Dragon Pavilion</b>, a prestigious clan known for defending mortals from demonic beasts.
<br>
<br>Even now, her fingers twitch as if prepared to summon a final technique.
<br>
<br>Do you:
<br>
<br><<if $hasHelped is true>>You’ve already drained your Qi. You cannot help another.
<br><<else>>Help [[righteous cultivator->Intro][$pe=4]]<</if>>
<br><<if $helpGiven eq "righteous">><<else>>Kill [[righteous cultivator->Intro][$pe=6]]<</if>><</if>>
<br>Return to observe [[demonic cultivator->Intro][$pe=3]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<br>
<br><<elseif $pe eq 3>><<if $hasKilled2 eq 1>><<else>>
<br><img src="images/Story/intro2.jpg" class=center width="60%">
<br>The man in black robes coughs violently, blood and bile leaking from his lips. Despite his wounds, his eyes flicker with cruel cunning. His Qi is wild—corrupted. A broken pendant rests beside him: the sigil of the <b>Ghost King Netherworld Sect</b>.
<br>
<br>Yet something about the way he clutches a charm in his hand feels... personal.
<br>
<br>Do you:
<br>
<br><<if $hasHelped is true>>You’ve already drained your Qi. You cannot help another.
<br><<else>>Help [[demonic cultivator->Intro][$pe=5]] <</if>>
<br><<if $helpGiven eq "evil">><<else>>Kill [[demonic cultivator->Intro][$pe=7]]<</if>><</if>>
<br>Return to observe [[righteous cultivator->Intro][$pe=2]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 4>>
<<set $hasHelped to true>>
<<set $helpGiven to "righteous">>
<br>You kneel beside her and press your palm to her back. Your Qi flows into her shattered meridians, stabilizing her foundation. She coughs blood, then gasps sharply as the pain fades.
<br>Her eyes flutter open—golden irises lock with yours. <span class="righteous">“You... saved me,”</span> she whispers.
<br>She presses a jade token into your hand.
<br><span class="righteous">“Take this. If you ever seek the <b>Clear Sky Azure Dragon Pavilion</b>, they will receive you.”</span>
<br>
<br>You are too drained to help another.
<<set $recommendationLetter to "righteous">>
<br>Return to observe [[demonic cultivator->Intro][$pe=3]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 5>>
<<set $hasHelped to true>>
<<set $helpGiven to "evil">>
<br>You crouch by his side, ignoring the corrupted aura. Focusing your Qi, you guide it into his mangled dantian. He groans, then snarls back to life—eyes glowing with crimson light.He coughs, then tosses you a blood-stained token.
<br><span class="demonic">“You're not like the others. If you want power… come to the <b>Ghost King Netherworld Sect</b>.”</span>
<br>
<br>You feel dizzy—there’s no way you could stabilize another after this.
<<set $recommendationLetter to "evil">>
<br>Return to observe [[righteous cultivator->Intro][$pe=2]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 6>>
<br>She tries to lift her head, eyes dazed. Your blade finds her throat before she can speak.
<br>
<br>It’s quick. Her blood steams in the cold mountain air.
<br>
<br>Among her shattered belongings, you find rare herb and some spirit stones. A cache worthy of a true cultivator.
<<gainRandomItem>> <<set $gold+=random(150,350)>>
<<set $hasKilled1 to 1>>
<br>Return to observe [[demonic cultivator->Intro][$pe=3]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 7>>
<br>He senses your approach—too late. Your strike pierces his heart with precision.
<br>
<br>He gurgles a curse and slumps back, lifeless. The dark mist around him vanishes.
<br>
<br>You rummage through his possessions: rare herb and some spirit stones.
<br>
<<gainRandomItem>> <<set $gold+=random(150,350)>>
<<set $hasKilled2 to 1>>
<br>Return to observe [[righteous cultivator->Intro][$pe=2]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<</if>>
<<set $playerX = 0>>
<<set $playerY = 13>>
<<set _tileSize = 50>>
<<set _x = $playerX * _tileSize>>
<<set _y = $playerY * _tileSize>>
<<set $regionEvent = {
active: false,
id: null,
x: null,
y: null,
duration: 0
}>>
<<set $map = [
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[1,1,1,1,1,1,0,0,0,2,2,0,0,-1],
[1,1,1,1,1,1,0,0,0,2,2,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,3,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,2,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1]
]>>
<<set $CurrentPcSectRank to "">>
<</nobr>><<set $playername to "Ziyan">>
<<set $playersurname to "Bai">>
<<audio "background1" volume 0.2 play loop>>
Welcome in <b><i>The Destined to Ascend</i></b>!
To begin, first select difficulty, then click 'Continue'.
<table class="stat-table">\
<tr>\
<th>Easy</th>
<th>Normal</th>
<th>Hard</th>
</tr>
<tr>
<td>
<b>🌍World</b>: Qi: High, Herb: High, Ore: High, Price: Low
<b>🧍♂️Character</b>: Initial stats: 150%, Higher grade of nature, ressurection stones = 9
<b>👹Monsters</b>: Monster HP: 75%, Monster damage: 75%, Monster ammount: Less frequent
<<link "Choose this difficulty" "Opening and Name">><<set $difficulty to "easy">><</link>>
</td>
<td>
<b>🌍World</b>: Qi: Normal, Herb: Normal, Ore: Normal, Price: Normal
<b>🧍♂️Character</b>: Initial stats: 100%, Standard grade of nature, ressurection stones = 6
<b>👹Monsters</b>: Monster HP: 100%, Monster damage: 100%, Monster ammount: Standard
<<link "Choose this difficulty" "Opening and Name">><<set $difficulty to "normal">><</link>>
</td>
<td>
<b>🌍World</b>: Qi: Low, Herb: Low, Ore: Low, Price: High
<b>🧍♂️Character</b>: Initial stats: 75%, Standard grade of nature, ressurection stones = 3
<b>👹Monsters</b>: Monster HP: 125%, Monster damage: 125%, Monster ammount: More frequent
<<link "Choose this difficulty" "Opening and Name">><<set $difficulty to "hard">><</link>>
</td>
</tr>
</table>
<<if $difficulty eq null>>Please select difficulty to continue.<<else>> Selected difficulty: <b>$difficulty</b>. <<link "Continue?" "Character Creation">><</link>><</if>><<if $verystart eq 0>><<else>>\
<br><<UpdatePortrait>>
<br><b>Name</b>: $playerfullname
<<if $activeSideMission neq null>>
<br><b>Current Mission:</b> <<print $activeSideMission.name>>
<<link "❌" `passage()`>>
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<</link>>
<</if>>
<br><b><<link "📖 Journal" "Journal">><</link>></b>
<div id="era-tracker">
<<EraTracker>>
</div>
<div id="stats-recovery">
<<statusCondition>>
</div>
<span style="font-size:10px; color:#b8860b; text-transform:uppercase;">Spirit Ambience</span><br>
<<volume>>
<br><b>Corruption</b>: $corruption
<br><b>Experience</b>: <<print $exp.toFixed(1)>>
<<if ndef $battleRound>>
<div class="newsidebar-nav-grid">
<span title="Status">
<<link "👤" "Status">><</link>>
</span>
<span title="Skills">
<<link "📜" "Skills">><</link>>
</span>
<span title="Inventory">
<<link "🎒" "Inventory">><</link>>
</span>
<span title="Relations">
<<link "🤝" "Relations">><</link>>
</span>
<span title="Breakthrough">
<<link "🪷" "Breakthrough">><</link>>
</span>
<span title="Help">
<<link "❓" "Help">><</link>>
</span>
</div>
<</if>>
<</if>>
<div class="newsidebar-system-footer">
<span title="Chronicles (Saves)">
<<link "💾">><<run UI.saves()>><</link>>
</span>
<span title="Meditation (Settings)">
<<link "⚙️">><<run UI.settings()>><</link>>
</span>
<span title="Rebirth (Restart)">
<<link "🔄">><<run UI.restart()>><</link>>
</span>
</div><<include Stats>>
<<include Naming>>
<<include Destiny>>
<<include PlayerI>>
<<include Items>>
<<include NPC>>
<<include AlchemyItems>>
<<include Potions>>
<<include PotionRecipes>>
<<include SideMissions>>
<<include SpecialArts>>
<<include Dtalks>>
<<include MainMissions>>
<<include MerchantItems>>
<<include WorldState>>
<<set _bgm = setup.SoundPath + "background1.mp3">>
<<cacheaudio "background1" _bgm>>
<<set _bgm = setup.SoundPath + "background2.mp3">>
<<cacheaudio "background2" _bgm>>
<<set $PlayerLocation to "">>
<<set $CurrentGameVersion to 0.16>>
<<set $gameVersion to 0.16>><<set $worldState to {
activeWar: null, /* Stores { sideA: "", sideB: "", endTurn: 0 } */
forbiddenZoneOpen: 0, /* Turn number when a zone closes */
globalCalamity: false
}>><<if $a eq 0>>
<<nobr>>
<div class="flex-container"><img src="images/Character/fmc.png" style="float: left;"><div>
<br><b>Surname:</b> $playersurname <b>Lifespan</b> : $lifespan / $maxlifespan
<br><b>Name:</b> $playername <b>Sex</b>: Female
<br><b>Charisma:</b>
<br><b>Realm:</b> <<cultivationStatus>>
<br><b>Internal Trait:</b> <span id="internalDisplay"><<= $internalTrait>></span>
<br><<for _index, _trait range $internalOptions>>
<<capture _t = _trait>>
<<link _trait>><<set $internalTrait to _trait>>
<<replace "#internalDisplay">><<=$internalTrait>>
<</replace>>
<</link>>
<</capture>>
<</for>>
<br><b>External Trait:</b> <span id="externalDisplay"><<= $externalTrait>></span>
<br><<for $index, _trait range $externalOptions>>
<<capture _t=_trait>>
<<link _trait>><<set $externalTrait to _trait>>
<<replace "#externalDisplay">><<=$externalTrait>>
<</replace>>
<</link>>
<</capture>>
<</for>>
</div>
<</nobr>>
<div style="text-align: center;">
Please choose your desired traits!
<<link "Stats" "Character Creation 2">><<set $a to 1>><</link>></div>
<<elseif $a eq 1>>
<div style="display: flex; align-items: center; gap: 20px;">
/* COLUMN 1: THE IMAGE */
<div style="flex: 0 0 auto;">
<img src="images/Character/fmc.png" style="max-height: 500px; display: block;">
</div>
<<ConstitutionCalc>>
/* COLUMN 2: THE DESTINY SELECTION */
<div style="flex: 1;">
<b><<link "⟳" "Character Creation 2">> <<set $destinyList.shuffle()>><<set $playerDestiny = []>><<updateDestinyStats>><</link>> Destiny </b>
<i>selected destinies:</i>
<span style="display: inline-block; margin-left: 10px;">
<<nobr>>
<<for _a to 0; _a lt $playerDestiny.length; _a++>>
<span style="margin-right: 10px;">
<<print _a + 1>>.
<<capture _a>>
<<link $playerDestiny[_a].name "Character Creation 2">>
<<set $playerDestiny.delete($playerDestiny[_a])>>
<<updateDestinyStats>>
<</link>>
<</capture>>
</span>
<</for>>
You have awakened the <<hovertip $constitutionDesc>><b>$constitutionName</b>!
<</hovertip>>
<</nobr>>
</span>
<div style="margin-top: 20px;">
<<nobr>>
<table style="width: 100%; table-layout: fixed; border-collapse: collapse;">
<tr>
<<for _d to 0; _d lt 4; _d++>>
<<set _destiny = $destinyList[_d]>>
<<capture _d, _destiny>>
<<set _statMap = {
"destinyatk": "Attack", "destinydef": "Defense", "destinycrit": "Critical Rate",
"destinycritres": "Crit Resist", "destinyagility": "Agility", "destinymartialArts": "Martial Arts",
"destinyspiritualRoot": "Spiritual Root", "righteousreputation": "Righteous Rep",
"demonicreputation": "Demonic Rep", "destinylifespan": "Lifespan",
"destinyenergy": "Energy", "destinyhealth": "Health"
}>>
<<set _tip = '<div style="width:300px; margin-bottom: 5px;">' + _destiny.description + '</div><hr><div style="display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 300px; font-size: 0.9em;">'>>
<<for _key, _label range _statMap>>
<<if _destiny[_key] !== 0>>
<<set _val = _destiny[_key]>>
<<set _color = (_val > 0 ? "#7fff00" : "#ff4500")>>
<<set _tip += '<span>' + _label + ': <b style="color:' + _color + ';">' + (_val > 0 ? "+" : "") + _val + '</b></span>'>>
<</if>>
<</for>>
<<set _tip += '</div>'>>
<td style="text-align: center; vertical-align: top; padding: 10px 2px;">
<<hovertip _tip>>
<div style="display: flex; flex-direction: column; align-items: center; min-height: 100px;">
<span style="font-size: 1.5em; margin-bottom: 8px;">
<<if _destiny.rarity is "Red">>🔴<<elseif _destiny.rarity is "Purple">>🟣<<elseif _destiny.rarity is "Orange">>🟠<<elseif _destiny.rarity is "Grey">>⚪<<elseif _destiny.rarity is "Green">>🟢<<elseif _destiny.rarity is "Blue">>🔵<</if>>
</span>
<<set _alreadyChosen to false>>
<<for _i to 0; _i lt $playerDestiny.length; _i++>>
<<if $playerDestiny[_i].name == _destiny.name>>
<<set _alreadyChosen to true>>
<</if>>
<</for>>
<div style="width: 90px; font-size: 0.85em; line-height: 1.2; overflow-wrap: break-word;">
<<if not _alreadyChosen>>
<<link _destiny.name "Character Creation 2">>
<<if $playerDestiny.length < 3>>
<<set $playerDestiny.push(_destiny)>>
<<updateDestinyStats>>
<</if>>
<</link>>
<<else>>
<span style="opacity: 0.4; filter: grayscale(100%);">_destiny.name</span>
<</if>>
</div>
</div>
<</hovertip>>
</td>
<</capture>>
<</for>>
</tr>
</table>
<</nobr>>
</div>
</div>
</div>
<p>
<table class="small-table">
<tr>
<th>General</th>
<th>Combat</th>
</tr>
<tr>
<td>
<br><b>🧬 Lifespan:</b> <<=$lifespan>> / <<=$maxlifespan>>
<br><b>❤️ Health:</b> <<=$health>> / <<=$maxhealth>>
<br><b>⚡ Energy:</b> <<=$energy>> / <<=$maxenergy>>
<br><b>🍀 Luck:</b> <<=$luck>>
<br><b>🧠 Insight:</b> <<=$insight>>
<br><b>💪 Strength:</b> <<=$basestrength>>
<br><b>🌀 Willpower:</b> <<=$basewillpower>>
<br><b>🧘♂️ Energy Recovery:</b> <<print $energyRecovery * 100>>%
</td>
<td>
<br><b>🗡️ Attack:</b> <<=$atk>>
<br><b>🛡️ Defense:</b> <<=$def>>
<br><b>💥 Crit Rate:</b> <<=$crit>>%
<br><b>🛑 Crit Resist</b>: <<=$critres>>%
<br><b>👟 Agility</b>: <<=$agility>>
<br><b>🥋 Martial Arts:</b> <<=$martialArts>>
<br><b>🌌 Spiritual Root:</b> <<=$spiritualRoot>>
<br><b>🩸 Health Recovery:</b> <<print $healthRecovery * 100>>%
</td>
</tr>
</table></p><</if>>
<<if $playerDestiny.length eq 3>><<link "Continue" "Intro">><<set $pe to 0>><<set $verystart to 1>><</link>><</if>>\
<div class="name-box">
<p>Enter your name and surname, or let fate decide.</p>
<<textbox "$playersurname" $playersurname>> <<link "<b>⟳</b>">> <<set $playersurname to $playersurnameList.random()>> <<run document.getElementById("textbox-playersurname").value = SugarCube.State.active.variables.playersurname>><</link>>
<<textbox "$playername" $playername>> <<link "<b>⟳</b>">> <<set $playername to $playernameList.random()>> <<run document.getElementById("textbox-playername").value = SugarCube.State.active.variables.playername>><</link>>
<div class="name-button">
<<link "Use This Name">>
<<goto "Character Creation 2">><<set $a to 0>>
<</link>>
</div>
</div>
<<set $internalTrait to $internalOptions.random()>>
<<set $externalTrait to $externalOptions.random()>><<widget "SoulflareReversal">>
Your soul ignites like a phoenix ember as you defy fate itself! Time rewinds and death is denied.
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $health = $health + $maxhealth * 0.3>>
<<set $soulflareUsed = true>>
You restore 30% of your health and resist death!
<<if $abilitylevel gte 2>>
<<set _reflected = $enemyatk * 0.5>>
<<set $enemycurrenthealth -= _reflected>>
You reflect $_reflected damage back to the enemy!
<</if>>
<</widget>>
<<widget "HeavenSplittingPalm">>
You summon your spiritual energy into your palm and unleash a Heaven-Splitting strike that shakes the heavens!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $defPierce = $currentEnemy.NPCdef * 0.5>>
<<set $abilityvalue = ($baseatk * 2.8) - $defPierce>>
<<if $abilitylevel gt 1>>
<<set $abilityvalue += 0.2 * $basestrength * $abilitylevel>>
<</if>>
You deal <<print $abilityvalue.toFixed(2)>> damage, ignoring part of enemy defense!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
<<if $abilitylevel gte 3 and random(1, 100) lte 25>>
<<set $enemyStaggered = true>>
The enemy is staggered and loses their next action!
<</if>>
<</widget>>
<<widget "StoneheartConstitution">>
You draw upon the tempered strength of your Stoneheart Constitution.
<<set $passivedef += 5 + ($level * 2)>>
Your base defense has increased by <<print 5 + ($activePassiveLevel * 2)>> points!
<</widget>>
<<widget "VenomFangSlash">>
You lunge forward with a venomous claw strike, leaving a lingering poison!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $defPierce = $currentEnemy.NPCdef * 0.3>>
<<set $abilityvalue = ($baseatk * 1.5) - $defPierce>>
You slash the enemy for $abilityvalue damage!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
<<set _poisonDmg = 0.05 * $maxhealth>>
The enemy is poisoned, taking $_poisonDmg damage over time!
<<if $abilitylevel gte 2>>
<<set _critChance = 20>>
<<if random(1,100) lte _critChance>>
<<set $critBonus = $abilityvalue * 0.5>>
Critical strike! You deal an extra $critBonus damage!
<<set $currentEnemy.NPCcurrenthealth -= $critBonus>>
<</if>>
The poison lasts longer at this level!
<</if>>
<</widget>>
<<widget "UnholyEndurance">>
You embrace the corruption within, hardening your body against pain.
<<set $passivedef += 10 + (2 * $abilitylevel)>>
Your defense rises by <<print 10 + (2 * $abilitylevel)>> points!
<<if $abilitylevel gte 2>>
<<set $resistStatus = true>>
You gain resistance to weakening and harmful effects!
<</if>>
<</widget>>
<<widget "BloodCurseMark">>
You carve a sigil of blood into the air, cursing your foe with dark power!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $abilityvalue = ($basemaxenergy * 2) - ($currentEnemy.NPCdef * 0.4)>>
You sacrifice health to empower the curse.
<<set $health -= 0.1 * $maxhealth>>
You lose 10% of your health but deal $abilityvalue damage!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
The enemy is cursed — their healing is reduced, and they take extra damage!
<<if $abilitylevel gte 2>>
The curse lingers longer and grows more vicious!
<</if>>
<<if $abilitylevel gte 3 and random(1,100) lte 30>>
Dark power spreads! Another nearby foe is also afflicted!
<</if>>
<</widget>>
<<widget "FallingStarPalm">>
You channel power into your palm and strike down like a blazing star, shattering the ground!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $defPierce = $currentEnemy.NPCdef * 0.4>>
<<set $abilityvalue = ($baseatk * 1.6) - $defPierce>>
You deal $abilityvalue damage with explosive force!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
<<if $abilitylevel gte 2>>
The strike’s impact radiates outward, hitting nearby foes for <<print $abilityvalue * 0.5>> splash damage!
<</if>>
<</widget>>
<<widget "RadiantLotus">>
A lotus of radiant qi blooms within you, harmonizing body and spirit.
Your healing effects are increased by <<print 10 + (5 * ($abilitylevel - 1))>>%!
<<if $abilitylevel gte 2>>
Your inner clarity strengthens, slightly improving your energy recovery!
<</if>>
<</widget>>
<<widget "HeavenwardBarrier">>
You raise a shield of celestial light, warding off death itself!
<<AbilityImagex $ability 250>><</AbilityImagex>>
The barrier will block a single fatal strike and restore health when triggered.
<<if $abilitylevel gte 2>>
The shield grows stronger, restoring more health when it activates!
<</if>>
<<if $abilitylevel gte 3>>
The celestial shield also reflects part of the blocked damage back at the attacker!
<</if>>
<</widget>><<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<</if>>
<<nobr>>
<div class="achievements-container">
<h2 class="achievements-title">Heavenly Records</h2>
<p class="achievements-count">
Unlocked: <<print State.variables.achievements.length>> / <<print window.achievementsList.length>>
</p>
<div class="achievements-scroll">
<<set _sortedList to window.getSortedAchievements()>>
<<set _unlocked to State.variables.achievements>>
<<for _ach range _sortedList>>
<<if _unlocked.includes(_ach.id)>>
<div class="achievement-item unlocked">
<div class="achievement-name"><<print _ach.title>></div>
<div class="achievement-desc"><<print _ach.desc>></div>
</div>
<<else>>
<div class="achievement-item locked">
<div class="achievement-name">???</div>
<div class="achievement-desc">A hidden truth awaits...</div>
</div>
<</if>>
<</for>>
</div>
<<link "Return" $passage>><</link>>
</div>
<</nobr>><<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<<else>>
<i>I should probably put some clothes on ...</i>
<</if>>
<<nobr>><<StatsUpdater>>
<div class="breakthrough-container">
<div class="breakthrough-header">
<h2>Breakthrough</h2>
<p>Channel your qi, face the heavens, and ascend to new heights!</p>
</div>
<img src="images/Story/breakthrough.png" class="breakthrough-portrait" alt="Cultivation Breakthrough">
<<Breakthrough>>
</div>
<</nobr>><<BreakthroughEvent>>rarity(high to low) - red, purple, orange, grey, green, blue
<<set $playerDestiny to []>>
BLANKDESTINY = [
{
"name": "NAME",
"rarity": "COLOR",
"description": "DESCRIPTION",
"destinyatk": 0,
"destinydef": 0,
"destinycrit": 0,
"destinycritres": 0,
"destinyagility": 0,
"destinymartialArts": 0,
"destinyspiritualRoot": 0,
"righteousreputation": 0,
"demonicreputation": 0,
"destinylifespan": 0,
"destinyenergy": 0,
"destinyhealth": 0,
<<set $destinyList to [
{
"name": "Child of Flame",
"rarity": "Red",
"description": "Born with the power of fire. Your soul burns brighter than others.",
"destinyatk": 5,
"destinydef": 2,
"destinycrit": 3,
"destinycritres": 0,
"destinyagility": 1,
"destinymartialArts": 0,
"destinyspiritualRoot": 5,
"righteousreputation": 5,
"demonicreputation": 0,
"destinylifespan": 0,
"destinyenergy": 10,
"destinyhealth": 0,
"essence": "Fire"
},
{
"name": "Silent Blade",
"rarity": "Blue",
"description": "Trained in the shadows, you strike before anyone senses danger.",
"destinyatk": 3,
"destinydef": 1,
"destinycrit": 5,
"destinycritres": 2,
"destinyagility": 5,
"destinymartialArts": 4,
"destinyspiritualRoot": 0,
"righteousreputation": 0,
"demonicreputation": 5,
"destinylifespan": 0,
"destinyenergy": 5,
"destinyhealth": 0,
"essence": "Martial"
},
{
"name": "Heaven's Oracle",
"rarity": "Purple",
"description": "Blessed with divine foresight, your insight shapes the world.",
"destinyatk": 1,
"destinydef": 0,
"destinycrit": 0,
"destinycritres": 3,
"destinyagility": 0,
"destinymartialArts": 0,
"destinyspiritualRoot": 8,
"righteousreputation": 10,
"demonicreputation": 0,
"destinylifespan": 50,
"destinyenergy": 20,
"destinyhealth": 0,
"essence": "Heaven"
},
{
"name": "Cursed Survivor",
"rarity": "Grey",
"description": "You lived, but something dark clings to your soul.",
"destinyatk": 2,
"destinydef": 3,
"destinycrit": 0,
"destinycritres": 4,
"destinyagility": 1,
"destinymartialArts": 1,
"destinyspiritualRoot": 0,
"righteousreputation": -5,
"demonicreputation": 10,
"destinylifespan": -10,
"destinyenergy": 0,
"destinyhealth": 20,
"essence": "Demonic"
},
{
"name": "Wandering Fist",
"rarity": "Green",
"description": "A martial nomad who trains endlessly under the open sky.",
"destinyatk": 3,
"destinydef": 3,
"destinycrit": 2,
"destinycritres": 1,
"destinyagility": 3,
"destinymartialArts": 6,
"destinyspiritualRoot": 0,
"righteousreputation": 3,
"demonicreputation": 0,
"destinylifespan": 10,
"destinyenergy": 5,
"destinyhealth": 10,
"essence": "Martial"
},
{
"name": "Undying Will",
"rarity": "Orange",
"description": "Even death cannot stop your pursuit of purpose.",
"destinyatk": 2,
"destinydef": 5,
"destinycrit": 0,
"destinycritres": 5,
"destinyagility": 0,
"destinymartialArts": 2,
"destinyspiritualRoot": 3,
"righteousreputation": 0,
"demonicreputation": 5,
"destinylifespan": 100,
"destinyenergy": 0,
"destinyhealth": 30,
"essence": "Body"
},
{
"name": "Scholar of Forbidden Tomes",
"rarity": "Purple",
"description": "You’ve studied secrets mortals weren’t meant to know.",
"destinyatk": 0,
"destinydef": 1,
"destinycrit": 2,
"destinycritres": 2,
"destinyagility": 0,
"destinymartialArts": 0,
"destinyspiritualRoot": 10,
"righteousreputation": -3,
"demonicreputation": 10,
"destinylifespan": 60,
"destinyenergy": 30,
"destinyhealth": -10,
"essence": "Mind"
},
{
"name": "Mountainheart",
"rarity": "Blue",
"description": "You are as resilient and unyielding as stone.",
"destinyatk": 2,
"destinydef": 8,
"destinycrit": 0,
"destinycritres": 5,
"destinyagility": -2,
"destinymartialArts": 2,
"destinyspiritualRoot": 0,
"righteousreputation": 3,
"demonicreputation": 0,
"destinylifespan": 20,
"destinyenergy": 0,
"destinyhealth": 30,
"essence": "Earth"
},
{
"name": "Eyes of the Hawk",
"rarity": "Green",
"description": "Nothing escapes your gaze, no motion goes unnoticed.",
"destinyatk": 1,
"destinydef": 1,
"destinycrit": 6,
"destinycritres": 1,
"destinyagility": 4,
"destinymartialArts": 2,
"destinyspiritualRoot": 1,
"righteousreputation": 0,
"demonicreputation": 0,
"destinylifespan": 0,
"destinyenergy": 0,
"destinyhealth": 0,
"essence": "Spirit"
},
{
"name": "Golden Child",
"rarity": "Orange",
"description": "You were born destined for greatness. The heavens favor you.",
"destinyatk": 3,
"destinydef": 3,
"destinycrit": 3,
"destinycritres": 3,
"destinyagility": 3,
"destinymartialArts": 3,
"destinyspiritualRoot": 3,
"righteousreputation": 10,
"demonicreputation": 0,
"destinylifespan": 50,
"destinyenergy": 15,
"destinyhealth": 15,
"essence": "Heaven"
},
{
"name": "Corrupt Apostle",
"rarity": "Red",
"description": "You speak for powers from beyond. Their whispers guide you.",
"destinyatk": 5,
"destinydef": 0,
"destinycrit": 4,
"destinycritres": 0,
"destinyagility": 1,
"destinymartialArts": 2,
"destinyspiritualRoot": 7,
"righteousreputation": -15,
"demonicreputation": 25,
"destinylifespan": 10,
"destinyenergy": 20,
"destinyhealth": 0,
"essence": "Demonic"
},
{
"name": "Beastkin Bloodline",
"rarity": "Grey",
"description": "Somewhere in your ancestry, a feral power sleeps.",
"destinyatk": 4,
"destinydef": 2,
"destinycrit": 2,
"destinycritres": 1,
"destinyagility": 4,
"destinymartialArts": 4,
"destinyspiritualRoot": -1,
"righteousreputation": -2,
"demonicreputation": 2,
"destinylifespan": -5,
"destinyenergy": 0,
"destinyhealth": 15,
"essence": "Beast"
},
{
"name": "Royal Lineage",
"rarity": "Purple",
"description": "Blue blood flows through your veins. Expectations weigh heavily.",
"destinyatk": 2,
"destinydef": 3,
"destinycrit": 2,
"destinycritres": 2,
"destinyagility": 2,
"destinymartialArts": 1,
"destinyspiritualRoot": 4,
"righteousreputation": 7,
"demonicreputation": -1,
"destinylifespan": 10,
"destinyenergy": 10,
"destinyhealth": 10,
"essence": "Heaven"
},
{
"name": "Exiled Monk",
"rarity": "Green",
"description": "Once devoted, now wandering and awakened by hardship.",
"destinyatk": 1,
"destinydef": 2,
"destinycrit": 0,
"destinycritres": 3,
"destinyagility": 3,
"destinymartialArts": 6,
"destinyspiritualRoot": 2,
"righteousreputation": 4,
"demonicreputation": 0,
"destinylifespan": 10,
"destinyenergy": 5,
"destinyhealth": 10,
"essence": "Spirit"
},
{
"name": "Soul Parasite",
"rarity": "Red",
"description": "You survived something you shouldn’t have. It still lives in you.",
"destinyatk": 6,
"destinydef": 0,
"destinycrit": 3,
"destinycritres": 0,
"destinyagility": 1,
"destinymartialArts": 0,
"destinyspiritualRoot": 8,
"righteousreputation": -10,
"demonicreputation": 20,
"destinylifespan": -20,
"destinyenergy": 20,
"destinyhealth": -10,
"essence": "Demonic"
},
{
"name": "Frostborn Nomad",
"rarity": "Blue",
"description": "Raised in cold silence, your heart beats like permafrost.",
"destinyatk": 3,
"destinydef": 5,
"destinycrit": 1,
"destinycritres": 4,
"destinyagility": 2,
"destinymartialArts": 1,
"destinyspiritualRoot": 1,
"righteousreputation": 1,
"demonicreputation": 0,
"destinylifespan": 5,
"destinyenergy": 5,
"destinyhealth": 10,
"essence": "Ice"
}
]>><<nobr>>
<div class="journal-container">
<h2>✦ The Scribe's Journal ✦</h2>
<!-- Filters -->
<div class="journal-filters">
<label>Filter by type:</label>
<select id="journal-filter-type">
<option value="all">All</option>
<option value="grudge">Grudges</option>
<option value="sex">Sexual Encounters</option>
<option value="combat">Combat & Deaths</option>
<option value="reputation">Reputation</option>
<option value="breakthrough">Breakthroughs</option>
<option value="cultivation">Cultivation</option>
<option value="story">Story Events</option>
<option value="mission">Missions</option>
</select>
<label>Sort by:</label>
<select id="journal-sort">
<option value="newest">Newest first</option>
<option value="oldest">Oldest first</option>
<option value="importance">Importance (high to low)</option>
</select>
<<if $journalEntries.length gt 0>>
<span class="journal-count">Total entries: <<print $journalEntries.length>></span>
<</if>>
</div>
<div id="journal-list">
<<if $journalEntries.length eq 0>>
<p class="empty-journal">The pages are blank... go make history!</p>
<<else>>
<<for _i = 0; _i lt $journalEntries.length; _i++>>
<<set _entry to $journalEntries[_i]>>
<div class="journal-entry importance-<<print _entry.importance>>" @data-type="_entry.type" @data-importance="_entry.importance" @data-timestamp="_entry.timestamp">
<div class="journal-header">
<span class="journal-icon">
<<if _entry.type eq "grudge">>⚔️
<<elseif _entry.type eq "sex">>❤️🔥
<<elseif _entry.type eq "combat">>⚔️
<<elseif _entry.type eq "reputation">>📢
<<elseif _entry.type eq "breakthrough">>🌊
<<elseif _entry.type eq "cultivation">>🧘
<<elseif _entry.type eq "story">>📜
<<elseif _entry.type eq "mission">>📋
<<else>>📖<</if>>
</span>
<span class="journal-title"><<print _entry.title>></span>
<span class="journal-date">
<<if _entry.age>>
Age <<print _entry.age>>
<<else>>
Turn <<print _entry.turn>>
<</if>>
</span>
</div>
<div class="journal-description">
<<print _entry.description>>
<<if _entry.location>>
<br><span class="journal-location">📍 <<print _entry.location>></span>
<</if>>
</div>
<<if _entry.relatedNPCName>>
<div class="journal-related">
👤 <<if _entry.relatedNPC and !$known_npc_list.find(function(n) { return n.id === _entry.relatedNPC and n.isDead; })>>
<<link _entry.relatedNPCName "RelationsDetailed">>
<<set $selectedNPCid to _entry.relatedNPC>>
<</link>>
<<else>>
<<print _entry.relatedNPCName>>
<<if $known_npc_list.find(function(n) { return n.id === _entry.relatedNPC and n.isDead; })>>
<span class="dead-tag">(Deceased)</span>
<</if>>
<</if>>
</div>
<</if>>
</div>
<</for>>
<</if>>
</div>
<div class="journal-footer">
<<link "Back" $passage>><</link>>
</div>
</div>
<<script>>
/* Debug version: logs data-type of each entry to browser console */
$(document).ready(function() {
var $typeSelect = $('#journal-filter-type');
var $sortSelect = $('#journal-sort');
if (!$typeSelect.length || !$sortSelect.length) return;
function filterAndSort() {
var type = $typeSelect.val();
var sort = $sortSelect.val();
var $entries = $('.journal-entry');
/* Log each entry's data-type to help debug filtering */
console.log("Selected filter: " + type);
$entries.each(function() {
console.log(" Entry data-type: " + $(this).data('type'));
});
/* Filter by type (show/hide) */
$entries.each(function() {
var $entry = $(this);
if (type === 'all' || $entry.data('type') === type) {
$entry.show();
} else {
$entry.hide();
}
});
/* Get visible entries */
var visible = $entries.filter(':visible').toArray();
/* Sort visible by selected criteria */
if (sort === 'newest') {
visible.sort(function(a, b) {
return $(b).data('timestamp') - $(a).data('timestamp');
});
} else if (sort === 'oldest') {
visible.sort(function(a, b) {
return $(a).data('timestamp') - $(b).data('timestamp');
});
} else if (sort === 'importance') {
visible.sort(function(a, b) {
return $(b).data('importance') - $(a).data('importance');
});
}
/* Reorder DOM: detach all entries, then append visible in order, then hidden */
var $allEntries = $('.journal-entry');
$allEntries.detach();
var $container = $('#journal-list');
visible.forEach(function(entry) {
$container.append(entry);
});
/* Append hidden entries after visible (so they stay in container but are hidden) */
$entries.filter(':hidden').each(function() {
$container.append(this);
});
}
$typeSelect.on('change', filterAndSort);
$sortSelect.on('change', filterAndSort);
filterAndSort(); /* initial filter & sort */
});
<</script>>
<</nobr>><<set $playeriteminventory to []>>
<<set $playeriteminventorybaselimit to 35>>
<<set $playerstashinventory to []>>
<<set $playerpotioninventory to []>>
<<set $playerspecialskill to []>>
<<set $playerpassiveskill to []>>
<<set $playerattackskill to []>>
<<set $knownRecipes = []>>
<<set $pcsidemissions = []>>
<<set $craft = false>>
<<set $spiritpavilion to 0>>
<<set $journalEntries = []>>
<<set $nextJournalId = 0>>
<<set $realmIndexMap = {
"Mortal": { "": 0 },
"Body Tempering Realm": 1,
"Meridian Awakening Realm": 2,
"Qi Condensation Realm": 3,
"Foundation Establishment Realm": 4,
"Core Formation Realm": 5,
"Nascent Soul Realm": 6
}>>
<<set $stageIndexMap = {
"Early": 0,
"Middle": 1,
"Late": 2
}>>
<<set $cultivationRealms = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set $cultivationStages = ["Early", "Middle", "Late"]>>
<<set $realmIndex = $realmIndexMap[$cultivationRealm]>>
<<set $stageIndex = $stageIndexMap[$cultivationStage]>>
<<set $requiredExp = 1000 * (1 + $realmIndexMap[$cultivationRealm]) * (1 + $stageIndexMap[$cultivationStage])>>
<<set $relationPage to 1>>
/* ITEMS */
/* ==================== OUTER ROBES ==================== */
<<set $simplerobes to {
name: "Simple Robes",
description: "Plain yet comfortable robes woven from spirit cotton. Light and easy to move in.",
stats: { agility: 1, willpower: 1, armor: 3 },
price: 80,
sellprice: 20,
class: "robe",
durability: 100,
maxDurability: 100,
corruptionLock: 0
}>>
<<set $travelerscloak to {
name: "Traveler's Cloak",
description: "A sturdy hooded cloak that shields against wind and minor qi fluctuations.",
stats: { willpower: 2, armor: 4 },
price: 150,
sellprice: 35,
class: "robe",
durability: 120,
maxDurability: 120,
corruptionLock: 0
}>>
<<set $cloudsilkgown to {
name: "Cloud-Silk Gown",
description: "Light as mist, this flowing gown allows qi to circulate freely through the body.",
stats: { agility: 2, willpower: 3, armor: 3 },
price: 320,
sellprice: 80,
class: "robe",
durability: 90,
maxDurability: 90,
corruptionLock: 0
}>>
<<set $phoenixfeatherrobe to {
name: "Phoenix Feather Robe",
description: "Soft crimson feathers shimmer faintly. Grants minor resistance to fire qi.",
stats: { strength: 1, agility: 1, willpower: 4, armor: 5 },
price: 680,
sellprice: 170,
class: "robe",
durability: 110,
maxDurability: 110,
corruptionLock: 0
}>>
<<set $nakedState to {
name: "Naked State",
description: "No robes or protection - bare skin exposed to the elements and prying eyes. A bold choice for the corrupted.",
stats: {},
price: 0,
sellprice: 0,
class: "naked",
corruptionLock: 95,
equipped: false,
durability: 0,
maxDurability: 0
}>>
/* ==================== UNDERWEAR ==================== */
<<set $silkunderrobe to {
name: "Silk Underrobe",
description: "Smooth silk worn beneath outer robes. Simple and comfortable.",
stats: { healthRecovery: 0.02 }, /* +2% health recovery */
price: 50,
sellprice: 10,
class: "underwear",
corruptionLock: 0
}>>
<<set $jadelotuslingerie to {
name: "Jade Lotus Lingerie",
description: "Delicate jade-green silk embroidered with tiny lotuses. Enhances yin essence flow and allure.",
stats: { agility: 1, charisma: 3 },
price: 280,
sellprice: 70,
class: "underwear",
lewd: true,
corruptionLock: 0
}>>
<<set $crimsonphoenixpanties to {
name: "Crimson Phoenix Panties",
description: "Fiery red silk that warms the lower dantian. Increases sensitivity and agility.",
stats: { agility: 2, pleasureBonus: 5 },
price: 220,
sellprice: 55,
class: "underwear",
lewd: true,
corruptionLock: 0
}>>
<<set $moonlightveil to {
name: "Moonlight Veil Underwear",
description: "Nearly transparent silver threads. Calms the mind and boosts willpower during intimate moments.",
stats: { willpower: 3 },
price: 350,
sellprice: 85,
class: "underwear",
lewd: true,
corruptionLock: 0
}>>
<<set $noUnderwear to {
name: "No Underwear",
description: "Wearing robes without undergarments - a daring and slightly indecent freedom that stirs dark desires.",
stats: {},
price: 0,
sellprice: 0,
class: "underwear",
corruptionLock: 45,
equipped: false,
durability: 0,
maxDurability: 0
}>>
/* ==================== ACCESSORIES ==================== */
<<set $jadehairpin to {
name: "Jade Hairpin",
description: "A simple jade hairpin that keeps stray thoughts at bay.",
stats: { willpower: 2, insight: 1 },
price: 120,
sellprice: 30,
class: "accessory"
}>>
<<set $spiritbellanklet to {
name: "Spirit Bell Anklet",
description: "Tiny silver bells chime softly with every step, sharpening footwork.",
stats: { agility: 3 },
price: 180,
sellprice: 45,
class: "accessory"
}>>
<<set $goldenwaistchain to {
name: "Golden Waist Chain",
description: "A delicate chain that rests on the hips. Visible when robes are torn—draws admiring glances.",
stats: { agility: 1, willpower: 1, armor: 1, charisma: 3 },
price: 250,
sellprice: 60,
class: "accessory",
lewd: true
}>>
<<set $phoenixtearnecklace to {
name: "Phoenix Tear Necklace",
description: "A single glowing tear said to contain phoenix essence. Greatly strengthens resolve.",
stats: { willpower: 4 },
price: 400,
sellprice: 100,
class: "accessory"
}>>
<<set $silkstockings to {
name: "Silk Stockings",
description: "Sheer black silk that clings to the legs.",
stats: { agility: 2, charisma: 4 },
price: 300,
sellprice: 75,
class: "accessory",
lewd: true
}>>
/* ==================== WEAPONS ==================== */
<<set $ironspiritsword to {
name: "Iron Spirit Sword",
description: "A reliable sword forged from spirit iron. Balanced and easy to wield.",
stats: { atk: 6 },
price: 200,
sellprice: 50,
class: "weapon"
}>>
<<set $crimsonlotussword to {
name: "Crimson Lotus Sword",
description: "Elegant blade with a crimson edge. Leaves trails of fiery lotus petals when swung.",
stats: { atk: 10, crit: 3 },
price: 450,
sellprice: 110,
class: "weapon"
}>>
<<set $jadewhip to {
name: "Jade Serpent Whip",
description: "Flexible whip carved from spirit jade. Perfect for binding foes—or playful teasing.",
stats: { atk: 8, agility: 4 },
price: 380,
sellprice: 95,
class: "weapon",
lewd: true
}>>
/* ==================== WEAPONS ==================== */
<<set $ironspiritsword to {"name": "Iron Spirit Sword","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 200, "sellprice": 50, "class": "weapon", "ability": 0, "description": "A reliable sword forged from spirit iron. Balanced and easy to wield.", "stats": {"atk": 15}}>>
<<set $crimsonlotussword to {"name": "Crimson Lotus Sword","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 450, "sellprice": 110, "class": "weapon", "ability": 0, "description": "Elegant blade with a crimson edge. Leaves trails of fiery lotus petals when swung.", "stats": {"atk": 25, "crit": 8}}>>
<<set $jadewhip to {"name": "Jade Serpent Whip","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 380, "sellprice": 95, "class": "weapon", "ability": 0, "description": "Flexible whip carved from spirit jade. Perfect for binding foes—or playful teasing.", "stats": {"atk": 20, "agility": 10}}>>
<<set $phoenixfan to {"name": "Phoenix Feather Fan","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 520, "sellprice": 130, "class": "weapon", "ability": 0, "description": "A beautiful folding fan made of phoenix feathers. Strikes release waves of scorching qi.", "stats": {"atk": 22, "crit": 12}}>>
/* EQUIPMENT SYSTEM */
<<set $equippedRobe to null>>
<<set $equippedUnderwear to null>>
<<set $equippedWeapon to null>>
<<set $equippedAccessories to [null, null, null]>>
<<set $robeInventory to []>>
<<set $underwearInventory to []>>
<<set $accessoryInventory to []>>
<<set $weaponInventory to []>>
/* ADD STARTER ITEMS */
<<set $robeInventory.push($cloudsilkgown, $nakedState)>>
<<set $underwearInventory.push($silkunderrobe, $noUnderwear)>>
<<set $accessoryInventory.push($jadehairpin, $silkstockings)>>
<<set $weaponInventory.push($ironspiritsword)>>
<<set $equippedRobe to $cloudsilkgown>>
<<set $equippedUnderwear to $silkunderrobe>>
<<set $equippedAccessories[0] to $jadehairpin>>
<<set $equippedAccessories[1] to $silkstockings>>
<<set $equippedWeapon to $ironspiritsword>><<nobr>>
<div style="position: relative; width: 70%; height: auto;">
<<BackgroundHandler>>
<img src="images/Story/meditation.png" style="width: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
<</nobr>>
You close your eyes and begin circulating your internal energy.
Qi flows through your meridians, washing over blockages and strengthening your foundation.
Minutes pass. Then hours.
As the spiritual energy around you fades, you open your eyes — your cultivation has progressed.
This opportunity is now gone, and the land feels... ordinary again.
<<set _gain to random(50, 250)>>
<<set $exp += _gain>>
You gain <<print _gain>> experience points!
<<return "Return!">><<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<<else>>
<i>I should probably put some clothes on ...</i>
<</if>>
<<nobr>>
<div class="skills-container">
<div class="skills-header">
<h2>Your Divine Techniques</h2>
<p>Secret arts and martial profundities forged on your path to ascension.</p>
</div>
<!-- Equipped Skills Slots -->
<div class="equipped-slots">
<div class="equipped-slot">
<div class="slot-title">Special Technique</div>
<div class="slot-content">
<<if $activeSpecialSkill neq "">>
<<print $activeSpecialSkill>>
<<link "Unequip" "Skills">>
<<for _j = 0; _j < $skillInventory.length; _j++>>
<<if $skillInventory[_j].name is $activeSpecialSkill>>
<<set $skillInventory[_j].isEquipped to false>>
<</if>>
<</for>>
<<set $activeSpecialSkill to "">>
<</link>>
<<else>>
<span style="color:#819ca9; font-style:italic;">None equipped</span>
<</if>>
</div>
</div>
<div class="equipped-slot">
<div class="slot-title">Passive Art</div>
<div class="slot-content">
<<if $activePassiveSkill neq "">>
<<print $activePassiveSkill>>
<<link "Unequip" "Skills">>
<<for _j = 0; _j < $skillInventory.length; _j++>>
<<if $skillInventory[_j].name is $activePassiveSkill>>
<<set $skillInventory[_j].isEquipped to false>>
<</if>>
<</for>>
<<set $activePassiveSkill to "">>
<<set $activePassiveWidget to "">>
<<set $activePassiveLevel to 0>>
<</link>>
<<else>>
<span style="color:#819ca9; font-style:italic;">None equipped</span>
<</if>>
</div>
</div>
<div class="equipped-slot">
<div class="slot-title">Martial Skill</div>
<div class="slot-content">
<<if $activeAttackSkill neq "">>
<<print $activeAttackSkill>>
<<link "Unequip" "Skills">>
<<for _j = 0; _j < $skillInventory.length; _j++>>
<<if $skillInventory[_j].name is $activeAttackSkill>>
<<set $skillInventory[_j].isEquipped to false>>
<</if>>
<</for>>
<<set $activeAttackSkill to "">>
<</link>>
<<else>>
<span style="color:#819ca9; font-style:italic;">None equipped</span>
<</if>>
</div>
</div>
<div class="equipped-slot">
<div class="slot-title">Dao imprint</div>
<div class="slot-content">
<<if $activeDaoImprint neq "">>
<<print $activeDaoImprint>>
<<else>>
<span style="color:#819ca9; font-style:italic;">You don't have any dao imprint!</span>
<</if>>
</div>
</div>
</div>
<!-- Category Tabs -->
<<if !$skillFilter>><<set $skillFilter to "passive">><</if>>
<div class="skill-tabs">
<<link "Passive Arts" "Skills">><<set $skillFilter to "passive">><<replace ".skill-tabs">><</replace>><<replace ".skills-table">><</replace>><</link>>
<<link "Special Techniques" "Skills">><<set $skillFilter to "special">><<replace ".skill-tabs">><</replace>><<replace ".skills-table">><</replace>><</link>>
<<link "Martial Skills" "Skills">><<set $skillFilter to "attack">><<replace ".skill-tabs">><</replace>><<replace ".skills-table">><</replace>><</link>>
</div>
<!-- Skills Table -->
<table class="skills-table">
<thead>
<tr>
<th>Technique</th>
<th>Description</th>
<th style="width:120px; text-align:center;">Level</th>
</tr>
</thead>
<tbody>
<<for _i = 0; _i < $skillInventory.length; _i++>>
<<set _skill = $skillInventory[_i]>>
<<if _skill.category is $skillFilter>>
<<capture _skill>>
<tr class="skill-row">
<td>
<div class="skill-name"><<print _skill.name>></div>
<<if (_skill.category is "special" and $activeSpecialSkill is _skill.name) or
(_skill.category is "passive" and $activePassiveSkill is _skill.name) or
(_skill.category is "attack" and $activeAttackSkill is _skill.name)>>
<span class="equipped-badge">Currently Equipped</span>
<<else>>
<<link "Equip" "Skills">>
<<if _skill.category is "special">>
<<for _j = 0; _j < $skillInventory.length; _j++>>
<<if $skillInventory[_j].category is "special">>
<<set $skillInventory[_j].isEquipped to false>>
<</if>>
<</for>>
<<set _skill.isEquipped to true>>
<<set $activeSpecialSkill to _skill.name>>
<<elseif _skill.category is "passive">>
<<for _j = 0; _j < $skillInventory.length; _j++>>
<<if $skillInventory[_j].category is "passive">>
<<set $skillInventory[_j].isEquipped to false>>
<</if>>
<</for>>
<<set _skill.isEquipped to true>>
<<set $activePassiveSkill to _skill.name>>
<<set $activePassiveWidget to _skill.widgetname>>
<<set $activePassiveLevel to _skill.level>>
<<elseif _skill.category is "attack">>
<<for _j = 0; _j < $skillInventory.length; _j++>>
<<if $skillInventory[_j].category is "attack">>
<<set $skillInventory[_j].isEquipped to false>>
<</if>>
<</for>>
<<set _skill.isEquipped to true>>
<<set $activeAttackSkill to _skill.name>>
<</if>>
<<replace ".equipped-slots">><</replace>>
<<replace ".skills-table">><</replace>>
<</link>>
<</if>>
</td>
<td><<print _skill.description>></td>
<td class="skill-level"><<print _skill.level>></td>
</tr>
<</capture>>
<</if>>
<</for>>
</tbody>
</table>
<<if $skillInventory.filter(s => s.category is $skillFilter).length eq 0>>
<p style="text-align:center; color:#819ca9; font-style:italic; margin:40px 0;">
No techniques of this category have been learned yet.
</p>
<</if>>
</div>
<</nobr>><<set $activeSpecialSkill to "">>
<<set $activePassiveSkill to "">>
<<set $activeAttackSkill to "">>
<<set $skillFilter = "passive">>
<<set $skillInventory to []>>
<!-- Special Skill -->
<<set $soulflareReversal to {
"name": "Soulflare Reversal",
"skillid": "soulflareReversal",
"widgetname": "SoulflareReversal",
"isEquipped": "false",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Burn your own soul essence to reverse a fatal blow, instantly healing a portion of your health and negating death once per battle.",
"leveldescription": "Cooldown is reduced. At higher levels, also reflects part of the damage back to the attacker."
}>>
<<set $skyPiercer to {
"name": "Sky Piercer",
"skillid": "skyPiercer",
"widgetname": "skyPiercer",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Pierce the heavens with a blade of Qi, dealing damage to all enemies and ignoring their barriers.",
"leveldescription": "Increases range and critical hit chance by 15%."
}>>
<<set $dragonSoulBurst to {
"name": "Dragon Soul Burst",
"skillid": "dragonSoulBurst",
"widgetname": "dragonSoulBurst",
"energy": 95,
"exp": 420,
"level": 1,
"levelexp": 520,
"levelenergy": -12,
"category": "special",
"description": "Unleash the essence of a dragon's soul, enhancing all attributes for 3 turns.",
"leveldescription": "Duration increases to 4 turns and buffs gain an additional 10% effect."
}>>
<!-- Passive Skill -->
<<set $stoneheartConstitution to {
"name": "Stoneheart Constitution",
"skillid": "stoneheartConstitution",
"widgetname": "StoneheartConstitution",
"isEquipped": "false",
"energy": 0,
"exp": 250,
"level": 1,
"levelexp": 350,
"levelenergy": 0,
"category": "passive",
"description": "Your body is tempered like jade and stone. Increases base defense and resistance to physical damage.",
"leveldescription": "Boosts passive defense further. At high levels, grants minor immunity to bleed and fracture effects."
}>>
<<set $flowingQi to {
"name": "Flowing Qi",
"skillid": "flowingQi",
"widgetname": "flowingQi",
"energy": 0,
"exp": 250,
"level": 1,
"levelexp": 350,
"levelenergy": 0,
"category": "passive",
"description": "Your Qi flows naturally — regenerate 5 energy each turn.",
"leveldescription": "Regeneration increases to 8 energy per turn."
}>>
<<set $ironMeridians to {
"name": "Iron Meridians",
"skillid": "ironMeridians",
"widgetname": "ironMeridians",
"energy": 0,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": 0,
"category": "passive",
"description": "Your meridians harden like steel — reduce all incoming damage by 10%.",
"leveldescription": "Damage reduction increases to 15%."
}>>
<!-- Attack Skill -->
<<set $heavenSplittingPalm to {
"name": "Heaven-Splitting Palm",
"skillid": "heavenSplittingPalm",
"widgetname": "HeavenSplittingPalm",
"isEquipped": "false",
"energy": 60,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": -5,
"category": "attack",
"description": "A devastating palm strike that channels spiritual force into raw destructive power. Ignores part of the enemy's defense.",
"leveldescription": "Damage increases with each level. High levels may cause 'stagger' or break enemy defense stance."
}>>
<<set $crimsonSlash to {
"name": "Crimson Slash",
"skillid": "crimsonSlash",
"widgetname": "crimsonSlash",
"energy": 60,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": -5,
"category": "attack",
"description": "A swift, deadly slash infused with spiritual fire — deals extra fire damage.",
"leveldescription": "Increases fire damage by 20% and adds a chance to burn the enemy."
}>>
<<set $phantomPalm to {
"name": "Phantom Palm",
"skillid": "phantomPalm",
"widgetname": "phantomPalm",
"energy": 50,
"exp": 270,
"level": 1,
"levelexp": 380,
"levelenergy": -4,
"category": "attack",
"description": "Strike with a wave of spiritual energy, dealing damage and potentially knocking the enemy back.",
"leveldescription": "Increases knockback chance and adds minor mental damage."
}>>
<!-- Dao Imprint -->
<<set $devouringessence to {
"name": "Devouring Essence",
"skillid": "devouringessence",
"widgetname": "DevouringEssence",
"isEquipped": "true",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": 0,
"category": "dao",
"statStealChance": 5, /* 5% chance to steal a base stat at Level 1 */
"description": "The mark of one who feeds upon the Dao itself. Your spirit asserts dominion over weaker foundations, forcibly claiming Qi, vitality, and latent potential. Where others cultivate, you harvest.",
"leveldescription": "Actively drains 5% of a target’s Qi and Health, permanently increasing your Max Qi and Max Health. At Level 1, there is a 5% chance to permanently seize 1 point of a random Base Stat from the victim. Higher levels increase drain efficiency and the chance to claim deeper aspects of their foundation."
}>>
<<set $harmonizedessence to {
"name": "Harmonized Essence",
"skillid": "harmonizedessence",
"widgetname": "HarmonizedEssence",
"isEquipped": "true",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": 0,
"category": "dao",
"statGainChance": 3, /* Lower chance than evil, but 'clean' and safe */
"description": "The mark of one aligned with the greater cycle. Your spirit resonates with Heaven’s rhythm, refining excess and discordant energies into stable growth. Nothing is stolen; all is returned in balance.",
"leveldescription": "Passively refines 5% of ambient and encounter-generated energy into permanent increases to Max Qi and Max Health, without harming others. At Level 1, there is a 3% chance to gain 1 point of a random Base Stat through sudden Dao insight. Higher levels improve refinement efficiency and the frequency of enlightenment."
}>>
<!--__________________________________________________________________________________________
__________________________________________________________________________________________!-->
<set $abc1 to {
"name": "abc1",
"skillid": "abc1",
"widgetname": "abc1",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "abc1",
"leveldescription": "abc1"
}>>
<-- Passive Skill -->
<<set $abc2 to {
"name": "abc2",
"skillid": "abc2",
"widgetname": "abc2",
"energy": 0,
"exp": 250,
"level": 1,
"levelexp": 350,
"levelenergy": 0,
"category": "passive",
"description": "abc2",
"leveldescription": "abc2"
}>>
<-- Attack Skill -->
<<set $abc3 to {
"name": "abc3",
"skillid": "abc3",
"widgetname": "abc3",
"energy": 60,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": -5,
"category": "attack",
"description": "abc3",
"leveldescription": "abc3"
}>>
__________________________________________________________________________________________
<<set $sectRanks = ["Initiate", "Disciple", "Inner Disciple", "Core Disciple", "True Disciple", "Elder", "Great Elder", "Sect Leader"]>>
<<set $sectManuals to []>>
<<set $sectManuals to {
"righteous": {
"Initiate": [
{
"name": "Falling Star Palm",
"skillid": "fallingStarPalm",
"widgetname": "FallingStarPalm",
"isEquipped": "false",
"energy": 30,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": -5,
"category": "attack",
"description": "A palm strike that descends like a falling star, striking with explosive force.",
"leveldescription": "Deals splash damage to nearby enemies.",
"ContributionPointCost": 60
},
{
"name": "Radiant Lotus Technique",
"skillid": "radiantLotus",
"widgetname": "RadiantLotus",
"isEquipped": "false",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 400,
"levelenergy": 0,
"category": "passive",
"description": "Your presence exudes righteous qi, increasing healing effects and inner clarity.",
"leveldescription": "Further enhances healing and energy regeneration.",
"ContributionPointCost": 50
},
{
"name": "Heavenward Barrier",
"skillid": "heavenwardBarrier",
"widgetname": "HeavenwardBarrier",
"isEquipped": "false",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Conjure a celestial shield that blocks a single fatal blow and restores health.",
"leveldescription": "Shorter cooldown and partial damage reflection at higher levels.",
"ContributionPointCost": 75
}
],
"Disciple": [
{
"name": "Soulflare Reversal",
"skillid": "soulflareReversal",
"widgetname": "SoulflareReversal",
"isEquipped": "false",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Burn your own soul essence to reverse a fatal blow, instantly healing a portion of your health and negating death once per battle.",
"leveldescription": "Cooldown is reduced. At higher levels, also reflects part of the damage back to the attacker."
}
],
"elder": []
},
"demonic": {
"Initiate": [
{
"name": "Venom Fang Slash",
"skillid": "venomFangSlash",
"widgetname": "VenomFangSlash",
"isEquipped": "false",
"energy": 35,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": -5,
"category": "attack",
"description": "A vicious claw strike infused with poison, dealing extra damage over time.",
"leveldescription": "Increased poison duration and critical hit chance.",
"ContributionPointCost": 60
},
{
"name": "Unholy Endurance",
"skillid": "unholyEndurance",
"widgetname": "UnholyEndurance",
"isEquipped": "false",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 400,
"levelenergy": 0,
"category": "passive",
"description": "Dark cultivation techniques harden your body, granting resistance to pain and weakening.",
"leveldescription": "Further boosts defense and resistance to negative effects.",
"ContributionPointCost": 50
},
{
"name": "Blood Curse Mark",
"skillid": "bloodCurseMark",
"widgetname": "BloodCurseMark",
"isEquipped": "false",
"energy": 100,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -15,
"category": "special",
"description": "Sacrifice your own blood to curse an enemy. Reduces their healing and increases damage taken.",
"leveldescription": "Longer curse duration and chance to spread to nearby foes.",
"ContributionPointCost": 75
}
],
"Dsciple": [],
"Elder": []
}
}>>--------------------------------------GENERAL---------------------------------------------
<!-- interaction calcul -->
<<set $power = {
"Mortal": { "": 0 },
"Body Tempering Realm": { "Early": 10, "Middle": 11, "Late": 12 },
"Meridian Awakening Realm": { "Early": 20, "Middle": 21, "Late": 22 },
"Qi Condensation Realm": { "Early": 30, "Middle": 31, "Late": 32 },
"Foundation Establishment Realm": { "Early": 40, "Middle": 41, "Late": 42 },
"Core Formation Realm": { "Early": 50, "Middle": 51, "Late": 52 },
"Nascent Soul Realm": { "Early": 60, "Middle": 61, "Late": 62 }
}>>
<!-- General stats -->
<<set $lifespan to 18>>
<<set $basemaxlifespan to 80>>
<<set $health to 300>>
<<set $basemaxhealth to 300>>
<<set $energy to 200>>
<<set $basemaxenergy to 200>>
<<set $baseluck to 5>>
<<set $baseinsight to 5>>
<<set $passiveatk to 0>>
<<set $passivedef to 0>>
<<set $passivecrit to 0>>
<<set $passivecritres to 0>>
<<set $passiveagility to 0>>
<<set $baseatk to 50>>
<<set $basedef to 5>>
<<set $basecrit to 3>>
<<set $basecritres to 1>>
<<set $baseagility to 7>>
<<set $basemartialArts to 10>>
<<set $basespiritualRoot to 10>>
<<set $basewillpower to 5>>
<<set $basestrength to 5>>
<<set $basecharisma to 5>>
<<set $energyRecovery = $basewillpower/100>>
<<set $healthRecovery = $basestrength/100>>
<<set $destinyatk = 0>>
<<set $destinydef = 0>>
<<set $destinycrit = 0>>
<<set $destinycritres = 0>>
<<set $destinyagility = 0>>
<<set $destinymartialArts = 0>>
<<set $destinyspiritualRoot = 0>>
<<set $destinylifespan to 0>>
<<set $destinyenergy to 0>>
<<set $destinyhealth to 0>>
<<set $atk = $baseatk + $destinyatk + ($basestrength*0.5) + $passiveatk>>
<<set $def = $basedef + $destinydef + $passivedef>>
<<set $crit = $basecrit + $destinycrit + $passivecrit>>
<<set $critres = $basecritres + $destinycritres + $passivecritres>>
<<set $agility = $baseagility + $destinyagility + $passiveagility>>
<<set $martialArts = $basemartialArts + $destinymartialArts>>
<<set $spiritualRoot = $basespiritualRoot + $destinyspiritualRoot>>
<<set $luck to $baseluck>>
<<set $insight to $baseinsight>>
<<set $evadescore = ($agility * 2) + ($insight * 1.5) + ($luck * 0.5)>>
<<set $maxlifespan to $basemaxlifespan + $destinylifespan>>
<<set $maxhealth to $basemaxhealth + $destinyenergy>>
<<set $maxenergy to $basemaxenergy + $destinyhealth>>
reputation -> WIDGET
<<set $charisma to $basecharisma>>
<<set $cultivationRealm to "Body Tempering Realm">>
<<set $cultivationStage to "Early">>
<<set $playerPower = $power[$cultivationRealm][$cultivationStage]>>
<<set $exp to 0>>
<<set $verystart to 0>>
<<set $gold to 0>>
<<set $lastRecoveryTurn = 0>>
<!--------------------------------------NSFW------------------------------------------------>
<<set $corruption to 0>> ->corruption
<<set $virginity to 1>> *if 1 then pc is virgin, else not*
<<set $virginityLost to "">>*with who pc lost virginity*
<<set $analVirginity to 1>>*if 1 then pc is virgin, else not*
<<set $analVirginityLost to "">> *with who pc lost virginity*
<<set $achievements = []>> <!-- Stores unlocked achievements -->
<<set $arousal = 0>>
<<set $maxArousal = 100>>
<!--------------------------------------MAP------------------------------------------------>
<<set $currentRegion to "Region1">>
<<set $sidemission to "inactive">>
<<set $sidemissionX to 0>>
<<set $sidemissionY to 0>>
<<set $turns = 0>>
<<set $turnsPerYear = 24>>
<!---------------------------------------------REPUTATION---------------------------------->
<<set $righteousreputation to 0>>
<<set $demonicreputation to 0>>
<<set $PCrighteousreputation to 0>>
<<set $PCdemonicreputation to 0>>
<<set $totalPCrighteousreputation to $PCrighteousreputation + $righteousreputation>>
<<set $totalPCdemonicreputation to $PCdemonicreputation + $demonicreputation>>
<<set $publicReputation to 0>>
<<set $hiddenReputation to 0>>
<<set $sectSuspicion to 0>>
<<set $fame to 0>>
<<set $sexFame to 0>>
<<set $combatFame to 0>>
<<set $cultivationFame to 0>>
<<set $sectFame to 0>>
<<set $totalFame to ($fame + $sectFame + $cultivationFame + $combatFame)>>
<!--------------------------------------MAIN PLOT------------------------------------------------>
<<set $mainStage0choice to "">>
<<set $activeDaoImprint to "">>
<!---------------------------------Player family------------------------------------------------->
<<if !$playerRelations>>
<<set $playerRelations = {
parents: [],
siblings: [],
children: [],
spouses: [],
lovers: [],
exes: [], /* NEW */
masters: [],
apprentices: [],
rivals: [] /* NEW */
}>>
<</if>>
<!--------------------------------------MISCELLANEOUS------------------------------------------------>
<<set $playerfullname to "$playername" + " " + "$playersurname">>
<<set $civilians_harmed to 0>>
<<set $hypocrisyScore to 0>>
<<set $sectLawPressure to 0>>
<<set $sectInvestigationLevel to 0>>
<<set $dualCultivationCount to 0>>
<<set $drainingActs to 0>>
<<set $consensualDualCultivation to 0>>
<<set $forcedExtraction to 0>>
<!--------------------------------------Sect Information------------------------------------------------>
<<set $CurrentPcSectRank to "">>
<<set $CurrentPcSectReputation to 0>>
<<set $CurrentPcSect to "">>
<<set $CurrentPcAffiliation to "">>
<<set $CurrentPcMainSect to "">>
<<set $ContributionPoints to 0>>
<<set $sectFavor to 0>>
<<set $CurrentPcSectRank = ["Initiate", "Disciple", "Inner Disciple", "Core Disciple", "True Disciple", "Elder", "Great Elder", "Sect Leader"]>>
<!--------------------------------------METERS------------------------------------------------>
<<newmeter 'health' 1>>
<<sizing '220px' '25px'>>
<<label "HP: $health / $maxhealth" 'black' center>>
<<colors '#2ecc71' '#e74c3c'>> /* Green to Red */
<</newmeter>>
<<newmeter 'energy' 1>>
<<sizing '220px' '25px'>>
<<label "Qi: $energy / $maxenergy" 'black' center>>
<<colors '#0377fc' '#9b59b6'>> /* Blue to Purple */
<</newmeter>>
<<newmeter 'timer' 0>>
<<colors 'red' 'green'>>
<<animation 10s linear>>
<</newmeter>><<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<<else>>
<i>I should probably put some clothes on ...</i>
<</if>>
<<StatsUpdater>>
<<if $treeVisible is undefined>>
<<set $treeVisible = false>>
<</if>>
<div style="text-align:center; margin:15px 0;">
<<if $treeVisible>>
<<link "🌳 Hide Family Tree" "Status">>
<<set $treeVisible = false>>
<</link>>
<<else>>
<<link "🌳 Show Family Tree" "Status">>
<<set $treeVisible = true>>
<<DrawPlayerTree>>
<</link>>
<</if>>
</div>
<div id="tree-container">
<<if $treeVisible>>
<<DrawPlayerTree>>
<</if>>
</div>
<<nobr>>
<div class="status-container">
<div class="status-header">
<<StatusPortrait>>
<div class="status-info">
<div><b>Surname:</b> $playersurname <b>Lifespan:</b> $lifespan / $maxlifespan</div>
<div><b>Name:</b> $playername <b>Sex:</b> Female</div>
<div><b>Charisma:</b> $charisma</div>
<div><b>Realm:</b> <span class="status-realm"><<cultivationStatus>></span></div>
<div><b>Internal Trait:</b> $internalTrait</div>
<div><b>External Trait:</b> <<print $externalTrait>></div>
<div><b>Sect Position:</b> <<print $CurrentPcSectRank>></div>
<div><b>Sect:</b> <<print $CurrentPcAffiliation>></div>
</div>
</div>
Your constitution: <span class="status-constitution"><<print $constitutionName>></span>
<br> <<link "H-status" "H-status">><</link>>
<div class="status-stats">
<!-- General Stats -->
<div class="stat-category">
<div class="category-title">General Cultivation</div>
<div class="stat-line"><span class="stat-label">🧬 Lifespan</span><span class="stat-value">$lifespan / $maxlifespan</span></div>
<div class="stat-line"><span class="stat-label">❤️ Health</span><span class="stat-value">$health / $maxhealth</span></div>
<div class="stat-line"><span class="stat-label">⚡ Energy (Qi)</span><span class="stat-value">$energy / $maxenergy</span></div>
<div class="stat-line"><span class="stat-label">🍀 Luck</span><span class="stat-value">$luck</span></div>
<div class="stat-line"><span class="stat-label">🧠 Insight</span><span class="stat-value">$insight</span></div>
<div class="stat-line"><span class="stat-label">💪 Strength</span><span class="stat-value">$basestrength</span></div>
<div class="stat-line"><span class="stat-label">🌀 Willpower</span><span class="stat-value">$basewillpower</span></div>
<div class="stat-line"><span class="stat-label">🧘♂️ Energy Recovery</span><span class="stat-value"><<print $energyRecovery * 100>>%</span></div>
</div>
<!-- Combat Stats -->
<div class="stat-category">
<div class="category-title">Combat Prowess</div>
<div class="stat-line"><span class="stat-label">🗡️ Attack</span><span class="stat-value high">$atk</span></div>
<div class="stat-line"><span class="stat-label">🛡️ Defense</span><span class="stat-value">$def</span></div>
<div class="stat-line"><span class="stat-label">💥 Critical Rate</span><span class="stat-value">$crit%</span></div>
<div class="stat-line"><span class="stat-label">🛑 Critical Resist</span><span class="stat-value">$critres%</span></div>
<div class="stat-line"><span class="stat-label">👟 Agility</span><span class="stat-value">$agility</span></div>
<div class="stat-line"><span class="stat-label">🥋 Martial Arts</span><span class="stat-value high">$martialArts</span></div>
<div class="stat-line"><span class="stat-label">🌌 Spiritual Root</span><span class="stat-value high">$spiritualRoot</span></div>
<div class="stat-line"><span class="stat-label">🩸 Health Recovery</span><span class="stat-value"><<print $healthRecovery * 100>>%</span></div>
</div>
</div>
</div>
<</nobr>><<RichQiPlace_Region1>> -> cultivation passage
<<RareHerbs_Region1>> -> rare herbs gathering<<widget "CreateNPC_Region1">>\
<<silently>>\
<<set _id = random(0, 10000) + Date.now()>>
<<set _gender = 0>>
<<set _RighteousTendencies = random(100,200)>>
<<set _DemonicTendencies = random(100,200)>>
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _name = $male_npc_names.random()>>
<<set _surname = $npc_surnames.random()>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = ["enemy1", "enemy2", "enemy3", "enemy4"].random()>>
<<set _fullname = _surname + " " + _name>>
<<set _imgID = random(0,10)>>,
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _stageType = ["Early", "Middle", "Late"].random()>>
<<set _realm = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"].random()>>
<<set _cultivation = _realm + " " +_stageType>>
<<set _sectAffiliation = ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect"].random()>>
<<if _sectAffiliation eq "Clear Sky Azure Dragon Pavilion">><<set _enemySect to "righteous">><<else>><<set _enemySect to "demonic">><</if>>
<<set _npcmentorship = 0>>
<<set _npcRelationship = 0>>
<<if _realm eq "Body Tempering Realm">>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(70, 80)>>
<<set _lifespanNPC = random(18,70)>>
<<set _maxhealthNPC = random(250, 320)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(180, 220)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(4, 6)>>
<<set _insightNPC = random(4, 6)>>
<<set _basestrengthNPC = random(4, 6)>>
<<set _basewillpowerNPC = random(4, 6)>>
<<set _atkNPC = random(35, 45)>>
<<set _defNPC = random(4, 6)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(1, 2)>>
<<set _agilityNPC = random(6, 8)>>
<<set _martialArtsNPC = random(8, 12)>>
<<set _spiritualRootNPC = random(9, 11)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(85, 115)>>
<<set _lifespanNPC = random(18,85)>>
<<set _maxhealthNPC = random(350, 450)>>
<<set _maxenergyNPC = random(250, 320)>>
<<set _luckNPC = random(6, 10)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(6, 9)>>
<<set _atkNPC = random(45, 85)>>
<<set _defNPC = random(6, 10)>>
<<set _critNPC = random(4, 7)>>
<<set _critresNPC = random(3, 5)>>
<<set _agilityNPC = random(8, 12)>>
<<set _martialArtsNPC = random(12, 18)>>
<<set _spiritualRootNPC = random(11, 14)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(115, 130)>>
<<set _lifespanNPC = random(18,115)>>
<<set _maxhealthNPC = random(500, 700)>>
<<set _maxenergyNPC = random(350, 500)>>
<<set _luckNPC = random(8, 14)>>
<<set _insightNPC = random(10, 16)>>
<<set _basestrengthNPC = random(11, 15)>>
<<set _basewillpowerNPC = random(10, 14)>>
<<set _atkNPC = random(85, 120)>>
<<set _defNPC = random(12, 18)>>
<<set _critNPC = random(6, 10)>>
<<set _critresNPC = random(6, 10)>>
<<set _agilityNPC = random(12, 18)>>
<<set _martialArtsNPC = random(16, 25)>>
<<set _spiritualRootNPC = random(15, 20)>>
<</if>>
<</if>>
<<if _realm eq "Meridian Awakening Realm">>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(135, 140)>>
<<set _lifespanNPC = random(18,135)>>
<<set _maxhealthNPC = random(750, 900)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(600, 720)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(10, 14)>>
<<set _insightNPC = random(12, 16)>>
<<set _basestrengthNPC = random(16, 20)>>
<<set _basewillpowerNPC = random(14, 18)>>
<<set _atkNPC = random(120, 170)>>
<<set _defNPC = random(20, 30)>>
<<set _critNPC = random(8, 12)>>
<<set _critresNPC = random(8, 12)>>
<<set _agilityNPC = random(16, 22)>>
<<set _martialArtsNPC = random(24, 32)>>
<<set _spiritualRootNPC = random(22, 30)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(145, 150)>>
<<set _lifespanNPC = random(18,145)>>
<<set _maxhealthNPC = random(1000, 1200)>>
<<set _maxenergyNPC = random(800, 1000)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(14, 20)>>
<<set _insightNPC = random(18, 24)>>
<<set _basestrengthNPC = random(20, 26)>>
<<set _basewillpowerNPC = random(18, 24)>>
<<set _atkNPC = random(170, 220)>>
<<set _defNPC = random(28, 40)>>
<<set _critNPC = random(10, 16)>>
<<set _critresNPC = random(10, 16)>>
<<set _agilityNPC = random(22, 30)>>
<<set _martialArtsNPC = random(30, 40)>>
<<set _spiritualRootNPC = random(28, 36)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(155, 160)>>
<<set _lifespanNPC = random(18,155)>>
<<set _maxhealthNPC = random(1400, 1800)>>
<<set _maxenergyNPC = random(1200, 1600)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(20, 28)>>
<<set _insightNPC = random(26, 34)>>
<<set _basestrengthNPC = random(28, 36)>>
<<set _basewillpowerNPC = random(26, 32)>>
<<set _atkNPC = random(220, 270)>>
<<set _defNPC = random(40, 55)>>
<<set _critNPC = random(14, 20)>>
<<set _critresNPC = random(14, 20)>>
<<set _agilityNPC = random(30, 40)>>
<<set _martialArtsNPC = random(38, 50)>>
<<set _spiritualRootNPC = random(35, 45)>>
<</if>>
<</if>>
<<if _realm eq "Qi Condensation Realm">>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(165, 170)>>
<<set _lifespanNPC = random(18,165)>>
<<set _maxhealthNPC = random(900, 900)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(600, 720)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(10, 14)>>
<<set _insightNPC = random(12, 16)>>
<<set _basestrengthNPC = random(16, 20)>>
<<set _basewillpowerNPC = random(14, 18)>>
<<set _atkNPC = random(270, 330)>>
<<set _defNPC = random(20, 30)>>
<<set _critNPC = random(8, 12)>>
<<set _critresNPC = random(8, 12)>>
<<set _agilityNPC = random(16, 22)>>
<<set _martialArtsNPC = random(24, 32)>>
<<set _spiritualRootNPC = random(22, 30)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(175, 180)>>
<<set _lifespanNPC = random(18,175)>>
<<set _maxhealthNPC = random(1000, 1200)>>
<<set _maxenergyNPC = random(800, 1000)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(14, 20)>>
<<set _insightNPC = random(18, 24)>>
<<set _basestrengthNPC = random(20, 26)>>
<<set _basewillpowerNPC = random(18, 24)>>
<<set _atkNPC = random(330, 380)>>
<<set _defNPC = random(28, 40)>>
<<set _critNPC = random(10, 16)>>
<<set _critresNPC = random(10, 16)>>
<<set _agilityNPC = random(22, 30)>>
<<set _martialArtsNPC = random(30, 40)>>
<<set _spiritualRootNPC = random(28, 36)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(185, 200)>>
<<set _lifespanNPC = random(18,185)>>
<<set _maxhealthNPC = random(1400, 1800)>>
<<set _maxenergyNPC = random(1200, 1600)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(20, 28)>>
<<set _insightNPC = random(26, 34)>>
<<set _basestrengthNPC = random(28, 36)>>
<<set _basewillpowerNPC = random(26, 32)>>
<<set _atkNPC = random(370, 430)>>
<<set _defNPC = random(40, 55)>>
<<set _critNPC = random(14, 20)>>
<<set _critresNPC = random(14, 20)>>
<<set _agilityNPC = random(30, 40)>>
<<set _martialArtsNPC = random(38, 50)>>
<<set _spiritualRootNPC = random(35, 45)>>
<</if>>
<</if>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<set _friendship = 0>>
<<set _had_sex = 0>>
<<set _talk = true>>
<<set _charm = random(1, 5)>>
<<set _depravity = random(7, 30)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _npc = {
id: _id,
IdImg: _imgID,
name: _name,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _sectAffiliation,
realm: _cultivation,
gender: _gender,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
RightTendencies: _RighteousTendencies,
DemonTendencies: _DemonicTendencies,
enemySectType: _enemySect
}>>
<</silently>>\
<</widget>>\
\
\
\
\
<<widget "ArrogantYoungMaster">>
<<silently>>
<<set _id = random(10001, 20000) + Date.now()>>
<<set _name = $male_npc_names.random()>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyability = []>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = ["aym", "aym2", "aym3", "aym4", "aym5", "aym6", "aym7","aym8","aym9","aym10"].random()>>
<<set _enemyability.push("attack", "attack")>>
<<set _stageType = ["Early", "Middle", "Late"].random()>>
<<if $cultivationRealm eq "Body Tempering Realm">><<set _realm = "Body Tempering Realm">><<elseif $cultivationRealm eq "Meridian Awakening Realm">>
<<set _realm = "Body Tempering Realm">><<elseif $cultivationRealm eq "Qi Condensation Realm">><<set _realm = "Meridian Awakening Realm">><</if>>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _cultivation = _realm + " " +_stageType>>
<<set _sectAffiliation = $npc_sects.random()>>
<<set _maxlifespanNPC = random(85, 115)>>
<<set _lifespanNPC = random(18,25)>>
<<set _maxhealthNPC = random(350, 450)>>
<<set _maxenergyNPC = random(250, 320)>>
<<set _luckNPC = random(6, 10)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(6, 9)>>
<<set _atkNPC = random(15, 22)>>
<<set _defNPC = random(6, 10)>>
<<set _critNPC = random(4, 7)>>
<<set _critresNPC = random(3, 5)>>
<<set _agilityNPC = random(8, 12)>>
<<set _martialArtsNPC = random(12, 18)>>
<<set _spiritualRootNPC = random(11, 14)>>
<<set _friendship = 0>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<set _npc = {
id: _id,
name: _name,
enemyimage: _enemyimage,
enemyregion: _enemyregion,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
friendship: _friendship,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _clan,
realm: _cultivation,
gender: _gender,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyAbility: _enemyability,
NPClocation: _location
}>>
<</silently>>
<</widget>>
<<widget "CreateMentor">>
<<silently>>
<!-- GENERATE CORE ID & GENDER -->
<<set _id = random(0, 10000) + Date.now()>>
<<set _gender = _setupGender ?? ["male","female"].random()>>
<<set _RighteousTendencies = random(100,200)>>
<<set _DemonicTendencies = random(100,200)>>
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _minAge = _setupAge ?? 30>> <!-- Mentors are at least 30 -->
<!-- GENERATE NAME -->
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _surname = _setupSurname ?? $npc_surnames.random()>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _surname = _setupSurname ?? $npc_surnames.random()>>
<</if>>
<<set _enemyregion = "Enemy">>
<!-- GENERATE PORTRAIT & IMAGE -->
<<if _gender eq "male">>
<<set _npcPortrait = "male" + random(1, 32)>>
<<set _enemyimage = ["master1", "master2", "master3"].random()>>
<<else>>
<<set _npcPortrait = "female" + random(1, 26)>>
<<set _enemyimage = ["mentress1", "mentress2", "mentress3"].random()>>
<</if>>
<<set _fullname = _surname + " " + _name>>
<<set _imgID = random(0,10)>>
<!-- PERSONALITY TRAITS (from CreateNPC001) -->
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<!-- NPC PROPERTIES (from CreateNPC001) -->
<<set _depravity = random(7, 30)>>
<<set _charm = 10>>
<<set _talk = 0>>
<<set _had_sex = 0>>
<<set _npcArousal = 0>>
<<set _npcmentorship = 1>>
<<set _npcRelationship = 0>>
<<set _friendship = 0>>
<!-- SECT AFFILIATION -->
<<set _sectRank to "Elder">>
<<set _sectAffiliation = ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect"].random()>>
<<if _sectAffiliation eq "Clear Sky Azure Dragon Pavilion">>
<<set _enemySect to "righteous">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Clear Sky Azure Dragon Pavilion"].random()>>
<<else>>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Ghost King Netherworld Sect"].random()>>
<<set _enemySect to "demonic">>
<</if>>
<!-- REALM & CULTIVATION -->
<<if _targetRealm and _targetStage>>
<<set _realm to _targetRealm>>
<<set _stageType to _targetStage>>
<<set _cultivation = _realm + " " + _stageType>>
<<set _power = $power[_realm][_stageType]>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<<else>>
<!-- Default: Mentors are high realm -->
<<set _realm = ["Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"].random()>>
<<set _stageType = ["Early", "Middle", "Late"].random()>>
<<set _cultivation = _realm + " " + _stageType>>
<<set _power = $power[_realm][_stageType]>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<</if>>
<!-- LIFESPAN & HEALTH GENERATION (from stats table) -->
<<set _maxlifespanNPC = random(_stats.lifespan[0], _stats.lifespan[1])>>
<<set _lifespanNPC = random(_minAge, _maxlifespanNPC)>>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currentenergyNPC = _maxenergyNPC>>
<!-- STAT GENERATION (from stats table) -->
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<!-- EVASION SCORE -->
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<!-- STATUS FLAGS -->
<<set _isMet = false>>
<<set _isFamiliar = false>>
<<set _isRelative = false>>
<<set _isUnknown = true>>
<<set _hasGrudge = false>>
<<set _isDead = false>>
<<set _killedByPlayer = false>>
<<set _killedInRevenge = false>>
<<set _deathCause = null>>
<<set _deathGrudgeType = null>>
<<set _deathGrudgeVictim = null>>
<!-- RELATIONSHIPS STRUCTURE -->
<<set _relations = {
parents: [],
swornParents: [],
masters: [],
spouses: [],
partners: [],
siblings: [],
swornSiblings: [],
children: [],
apprentices: []
}>>
<!-- CREATE MENTOR OBJECT -->
<<set _npc = {
id: _id,
IdImg: _imgID,
name: _name,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _sectAffiliation,
realm: _cultivation,
gender: _gender,
npcPortrait: _npcPortrait,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: _lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
RightTendencies: _RighteousTendencies,
DemonTendencies: _DemonicTendencies,
enemySectType: _enemySect,
NPCrank: _sectRank,
power: _power,
npcArousal: _npcArousal,
/* STATUS FLAGS */
isMet: _isMet,
isFamiliar: _isFamiliar,
isRelative: _isRelative,
isUnknown: _isUnknown,
hasGrudge: _hasGrudge,
isDead: _isDead,
killedByPlayer: _killedByPlayer,
killedInRevenge: _killedInRevenge,
deathCause: _deathCause,
deathGrudgeType: _deathGrudgeType,
deathGrudgeVictim: _deathGrudgeVictim,
/* RELATIONSHIP TRACKING */
relations: _relations
}>>
<</silently>>
<</widget>>
<<widget "CreateNPC001">>
<<silently>>
<<set _id = random(0, 10000) + Date.now()>>
<<set _gender = _setupGender ?? ["male","female"].random()>>
<<set _RighteousTendencies = random(100,200)>>
<<set _DemonicTendencies = random(100,200)>>
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _minAge = _setupAge ?? 18>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _surname = _setupSurname ?? $npc_surnames.random()>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _surname = _setupSurname ?? $npc_surnames.random()>>
<</if>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = ["enemy1", "enemy2", "enemy3", "enemy4"].random()>>
<<if _gender eq "male">>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _fullname = _surname + " " + _name>>
<<set _imgID = random(0,10)>>
<<set _sectAffiliation = ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect", "Unafiliated"].random()>>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<if _sectAffiliation eq "Clear Sky Azure Dragon Pavilion">><<set _enemySect to "righteous">><<elseif _sectAffiliation eq "Ghost King Netherworld Sect">><<set _enemySect to "demonic">><<else>><<set _enemySect to ["righteous", "demonic"].random() >><</if>>
<<set _npcmentorship = 0>>
<<set _npcRelationship = 0>>
<<if _sectAffiliation eq "Unafiliated">><<set _sectRank to "">><<else>><<set _sectRank to ["Member", "Disciple", "Elder"].random()>><</if>>
<<set _depravity = random(7, 30)>>
<<set _friendship = 0>>
<<set _charm to 10>>
<<set _talk to 0>>
<<set _had_sex to 0>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<if _targetRealm and _targetStage>>
<<set _realm to _targetRealm>>
<<set _stageType to _targetStage>>
/* Clear them out after using them so they don't infect non-tournament battles */
<<set _cultivation = _realm + " " +_stageType>>
<<set _power = $power[_realm][_stageType]>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<<else>>
<<set _realm = ["Body Tempering Realm","Meridian Awakening Realm","Qi Condensation Realm"].random()>>
<<set _stageType = ["Early","Middle","Late"].random()>>
<<set _cultivation = _realm + " " +_stageType>>
<<set _power = $power[_realm][_stageType]>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<</if>>
<<set _maxlifespanNPC = random(_stats.lifespan[0], _stats.lifespan[1])>>
<<set _lifespanNPC = random(_minAge, _maxlifespanNPC)>>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _npcArousal = 0>>
<<set _npc = {
npcArousal: _npcArousal,
id: _id,
IdImg: _imgID,
name: _name,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _sectAffiliation,
realm: _cultivation,
gender: _gender,
npcPortrait: _npcPortrait,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: _lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
RightTendencies: _RighteousTendencies,
DemonTendencies: _DemonicTendencies,
enemySectType: _enemySect,
NPCrank: _sectRank,
power: _power,
isMet: false,
isFamiliar: false,
isRelative: false,
isUnknown: true,
hasGrudge: false,
deathCause: null, /* "old_age", "murder", "revenge_killed", etc.*/
killedByPlayer: false,
killedInRevenge: false, /* true if killed during a revenge encounter*/
deathGrudgeType: null, /* the type of grudge they were avenging*/
deathGrudgeVictim: null, /* the victim they were avenging*/
isDead: (_setupDead ?? false),
relations: {
parents: [],
swornParents: [],
masters: [],
spouses: [],
partners: [],
siblings: [],
swornSiblings: [],
children: [],
apprentices: []
}
}>>
<</silently>>
<</widget>>
<<widget "GenerateLineageBatch">>
<<silently>>
<<set _existingMain to $args[0] || null>>
<<set $encounterBatch to {}>>
<<set _allNPCs to []>> /* Track all generated NPCs for cross-linking */
/* 1. Generate or use the Focus NPC */
<<if _existingMain>>
<<set _main to _existingMain>>
<<set $encounterMainID to _main.id>>
<<set $encounterBatch[_main.id] to _main>>
<<else>>
<<CreateNPC001>>
<<set _main to _npc>>
<<set _main.isMet to true>>
<<set $encounterMainID to _main.id>>
<<set $encounterBatch[_main.id] to _main>>
<</if>>
/* Ensure main NPC has all relation arrays */
<<if not _main.relations>>
<<set _main.relations to {}>>
<</if>>
<<set _relTypes to ["parents", "swornParents", "masters", "spouses", "partners", "siblings", "swornSiblings", "children", "apprentices", "lovers", "ex_lovers", "betrothed"]>>
<<for _type range _relTypes>>
<<if not _main.relations[_type]>>
<<set _main.relations[_type] to []>>
<</if>>
<</for>>
<<set _allNPCs.push(_main)>>
/* 2. PARENTS (Father & Mother) */
<<set _parentPool to [
{ type: "father", chance: 60, gender: "male", sameSurname: true, ageMod: [20, 50] },
{ type: "mother", chance: 50, gender: "female", sameSurname: false, ageMod: [18, 45] }
]>>
<<for _rel range _parentPool>>
<<if random(1, 100) lte _rel.chance>>
<<set _setupSurname to (_rel.sameSurname ? _main.surname : null)>>
<<set _setupAge to _main.NPClifespan + random(_rel.ageMod[0], _rel.ageMod[1])>>
<<set _setupGender to _rel.gender>>
<<set _setupDead to (random(1, 100) lt 20)>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
/* Create two-way parent-child links */
<<run _main.relations.parents.push(_rNPC.id)>>
<<run _rNPC.relations.children.push(_main.id)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* 3. LOVERS AND ROMANTIC CONNECTIONS */
<<set _romancePool to [
{ type: "lover", chance: 30, category: "lovers", ageMod: [-5, 5] },
{ type: "ex_lover", chance: 15, category: "ex_lovers", ageMod: [-10, 10] },
{ type: "betrothed", chance: 10, category: "betrothed", ageMod: [-5, 5] }
]>>
<<for _rel range _romancePool>>
<<if random(1, 100) lte _rel.chance>>
<<set _setupGender to (_main.gender == "male" ? "female" : "male")>>
<<set _setupSurname to null>> /* Lovers keep their own surnames */
<<set _setupAge to _main.NPClifespan + random(_rel.ageMod[0], _rel.ageMod[1])>>
<<set _setupDead to (random(1, 100) lt 15)>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
/* Create two-way romantic links */
<<if _rel.type eq "lover">>
<<run _main.relations.lovers.push(_rNPC.id)>>
<<run _rNPC.relations.lovers.push(_main.id)>>
<<elseif _rel.type eq "ex_lover">>
<<run _main.relations.ex_lovers.push(_rNPC.id)>>
<<run _rNPC.relations.ex_lovers.push(_main.id)>>
<<elseif _rel.type eq "betrothed">>
<<run _main.relations.betrothed.push(_rNPC.id)>>
<<run _rNPC.relations.betrothed.push(_main.id)>>
<</if>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* 4. SIBLINGS */
<<set _siblingCount to random(0, 3)>>
<<set _siblings to []>>
<<for _i = 0; _i lt _siblingCount; _i++>>
<<if random(1, 100) lt 40>>
<<set _setupSurname to _main.surname>>
<<set _setupAge to _main.NPClifespan + random(-10, 10)>>
<<set _setupDead to (random(1, 100) lt 15)>>
<<set _setupGender to ["male", "female"].random()>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
<<set _siblings.push(_rNPC)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* Link siblings to each other and to parents */
<<for _sibling range _siblings>>
/* Link to main */
<<if not _main.relations.siblings.includes(_sibling.id)>>
<<run _main.relations.siblings.push(_sibling.id)>>
<</if>>
<<if not _sibling.relations.siblings.includes(_main.id)>>
<<run _sibling.relations.siblings.push(_main.id)>>
<</if>>
/* Link to parents if they exist */
<<for _parentId range _main.relations.parents>>
<<if not _sibling.relations.parents.includes(_parentId)>>
<<run _sibling.relations.parents.push(_parentId)>>
<</if>>
/* Add sibling to parent's children */
<<set _parent = $encounterBatch[_parentId]>>
<<if _parent and not _parent.relations.children.includes(_sibling.id)>>
<<run _parent.relations.children.push(_sibling.id)>>
<</if>>
<</for>>
<</for>>
/* 5. MASTERS */
<<set _masterCount to random(1, 2)>>
<<for _i = 0; _i lt _masterCount; _i++>>
<<if random(1, 100) lt 30>>
<<set _setupAge to _main.NPClifespan + random(30, 100)>>
<<set _setupDead to (random(1, 100) lt 25)>>
<<set _setupGender to ["male", "female"].random()>>
<<set _setupSurname to null>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
<<run _main.relations.masters.push(_rNPC.id)>>
<<run _rNPC.relations.apprentices.push(_main.id)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* 6. APPRENTICES */
<<if _main.NPClifespan gt 30>>
<<set _apprCount to random(0, 2)>>
<<for _i = 0; _i lt _apprCount; _i++>>
<<if random(1, 100) lt 25>>
<<set _setupAge to random(18, _main.NPClifespan - 10)>>
<<set _setupDead to (random(1, 100) lt 15)>>
<<set _setupGender to ["male", "female"].random()>>
<<set _setupSurname to null>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
<<run _main.relations.apprentices.push(_rNPC.id)>>
<<run _rNPC.relations.masters.push(_main.id)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
<</if>>
/* 7. FINAL PASS: Ensure all family connections are complete */
<<for _npc1 range _allNPCs>>
<<for _npc2 range _allNPCs>>
<<if _npc1.id != _npc2.id>>
/* If they share parents, ensure sibling link exists */
<<set _shareParents to false>>
<<for _parentId range _npc1.relations.parents>>
<<if _npc2.relations.parents.includes(_parentId)>>
<<set _shareParents to true>>
<</if>>
<</for>>
<<if _shareParents>>
<<if not _npc1.relations.siblings.includes(_npc2.id)>>
<<run _npc1.relations.siblings.push(_npc2.id)>>
<</if>>
<<if not _npc2.relations.siblings.includes(_npc1.id)>>
<<run _npc2.relations.siblings.push(_npc1.id)>>
<</if>>
<</if>>
/* Ensure child-parent links are bidirectional */
<<if _npc1.relations.parents.includes(_npc2.id) and not _npc2.relations.children.includes(_npc1.id)>>
<<run _npc2.relations.children.push(_npc1.id)>>
<</if>>
<<if _npc2.relations.parents.includes(_npc1.id) and not _npc1.relations.children.includes(_npc2.id)>>
<<run _npc1.relations.children.push(_npc2.id)>>
<</if>>
<</if>>
<</for>>
<</for>>
<</silently>>
<</widget>><<set $male_npc_names = [
"Yun","Jie","Tian","Rui","Sheng","Zhen","Hao","Lei","Qing","Long","Xuan","Bo","Chen","Yue","Jin","Wei","Ren","Fang","Yao","Heng","Zhi","Xing","Han","Fei","Chao"
]>>
<<set $female_npc_names = [
"Mei","Lian","Hua","Xue","Ling","Yue","Lan","Qin","Rin","Yin","Shui","Fen","Zhi","Ai","Na","Yu","Ning","Ting","Xia","Bo","Qiao","Min","Ruo","Li","Jing"
]>>
<<set $npc_surnames = [
"Li","Zhao","Mo","Feng","Shen","Wei","Jiang","Han","Leng","Wu","Zhou","Yan","Bai","Chen","Duan","Qin","Xie","Lin","Zhang","Gu"
]>>
<<set $known_npc_list = []>>
<<set $npc_list = []>>
<<set $npc_fem_list = []>>
<<set $active_npc = []>>
<<set $npc_sects =[
"Heavenly Sword Pavilion", "Dragonblood Imperial Clan", "Violet Flame Sect", "Sun-Crushing Hall", "Everlasting Sky Clan", "Black Jade Phoenix Palace", "Golden Tyrant Sect", "Thousand Thunder Pavilion"
]>>
<<set $enemyBattleQuotes = [
"Your moves are crude. Were you trained by farmers?",
"Hah! Is that all your sect has taught you?",
"You dare face me with such pitiful strength?",
"The heavens themselves tremble at my cultivation!",
"You’ll need more than flashy footwork to defeat me.",
"Even my juniors hit harder than that.",
"Your fate was sealed the moment you stepped into this arena.",
"My qi flows like a raging river. You cannot stop it.",
"You might land a strike, but you’ll never break my will.",
"Come! Let this be a lesson written in bruises.",
"You fight with courage... but lack wisdom.",
"Still standing? Impressive... but futile.",
"This duel is over — you just don’t know it yet.",
"Your spiritual roots are weak. I sense no destiny in you.",
"Let’s see how long that arrogance lasts under pressure.",
"You hold back. Why? Are you afraid of your own strength?",
"I’ve bested beasts with more fight than you.",
"Is this what the righteous path teaches now? Pathetic.",
"You're not bad... but I won’t lose to someone like you.",
"A spark of talent — wasted on someone without control."
]>>
<<set $neutralTalkNPC to [
"You look like a new face around here.",
"Not many travelers pass through this area.",
"What brings you to this place?",
"Be careful. Not all cultivators are as kind as they appear.",
"The spiritual energy feels dense today, doesn't it?"
]>>
<<set $friendlyTalkNPC to [
"It’s always good to see a friendly face.",
"Training hard again? You never take a break.",
"I found a quiet spot by the waterfall—you’d love it.",
"Let me know if you ever need help with your cultivation.",
"The sect's been talking about your progress. You're not bad."
]>>
<<set $loverTalkNPC to [
"I dreamed of you last night…",
"Come closer. I want to feel your presence.",
"You always make my heart feel lighter.",
"After everything, I’m glad we met.",
"When this world turns to chaos, remember you have me."
]>>
<<set $highDepravityTalkNPC to [
"Power is the only language worth speaking.",
"Desire isn't a weakness—it's fuel.",
"Have you ever killed someone and felt… exhilarated?",
"Kindness? That's a lie we tell ourselves.",
"I could show you things you'd never forget… if you're brave enough."
]>>
<<set $MentorTalkNPC to [
"Your stance is improving. Slightly.",
"Discipline, focus, and patience—that’s the path.",
"Did you review the techniques I assigned?",
"Even a spark can become a flame. Don’t waste your potential.",
"I was once like you… hungry for power, blind to the cost."
]>>
<<set $ApprenticeTalkNPC to [
"Master, do you think I’m ready for the next realm?",
"I tried the technique you showed me, but something feels off.",
"Thank you for taking me in. I won’t disappoint you.",
"Sometimes I wonder why you chose me.",
"Your teachings… they saved me more than once."
]>>
<<set $enemyTalkNPC to [
"Still alive? Disappointing.",
"One day, I’ll surpass you. Count on it.",
"Don’t think I’ve forgotten what you did.",
"You may have power, but you lack honor.",
"Every time we speak, I lose more respect for you."
]>>
<<set $highTalk to [
"You’ve changed since we first met.",
"Talking to you always makes things clearer.",
"Strange… I never thought I’d trust someone like you.",
"So much has happened, hasn’t it?",
"Even in silence, your presence comforts me."
]>>
<<set $activeGrudges to []>> // Array to store active grudges
/* Grudge structure:
// {
// id: unique_id,
// avengerId: npc_id,
// victimId: npc_id (the one who was wronged or their relative),
// type: "rape", "seduction", "murder", "theft", "humiliation", "betrayal",
// severity: 1-10,
// targetType: "player", "npc",
// triggered: false,
// location: "any", "city", "wilderness", "sect",
// relationshipToVictim: "lover", "parent", "sibling", "master", "friend"
// } */
<<set $cultivationRealms = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set $cultivationStages = ["Early", "Middle", "Late"]>>
<<set $GenerationNPCRealmStats = {
"Body Tempering Realm": {
"Early": {
"lifespan": [70, 80],
"health": [250, 320],
"energy": [180, 220],
"luck": [4, 6],
"insight": [4, 6],
"basestrength": [4, 6],
"basewillpower": [4, 6],
"atk": [35, 45],
"def": [4, 6],
"crit": [2, 4],
"critres": [1, 2],
"agility": [6, 8],
"martialArts": [8, 12],
"spiritualRoot": [9, 11]
},
"Middle": {
"lifespan": [85, 115],
"health": [350, 450],
"energy": [250, 320],
"luck": [6, 10],
"insight": [6, 10],
"basestrength": [7, 10],
"basewillpower": [6, 9],
"atk": [45, 85],
"def": [6, 10],
"crit": [4, 7],
"critres": [3, 5],
"agility": [8, 12],
"martialArts": [12, 18],
"spiritualRoot": [11, 14]
},
"Late": {
"lifespan": [115, 130],
"health": [500, 700],
"energy": [350, 500],
"luck": [8, 14],
"insight": [10, 16],
"basestrength": [11, 15],
"basewillpower": [10, 14],
"atk": [85, 120],
"def": [12, 18],
"crit": [6, 10],
"critres": [6, 10],
"agility": [12, 18],
"martialArts": [16, 25],
"spiritualRoot": [15, 20]
}
},
"Meridian Awakening Realm": {
"Early": {
"lifespan": [135, 140],
"health": [750, 900],
"energy": [600, 720],
"luck": [10, 14],
"insight": [12, 16],
"basestrength": [16, 20],
"basewillpower": [14, 18],
"atk": [120, 170],
"def": [20, 30],
"crit": [8, 12],
"critres": [8, 12],
"agility": [16, 22],
"martialArts": [24, 32],
"spiritualRoot": [22, 30]
},
"Middle": {
"lifespan": [145, 150],
"health": [1000, 1200],
"energy": [800, 1000],
"luck": [14, 20],
"insight": [18, 24],
"basestrength": [20, 26],
"basewillpower": [18, 24],
"atk": [170, 220],
"def": [28, 40],
"crit": [10, 16],
"critres": [10, 16],
"agility": [22, 30],
"martialArts": [30, 40],
"spiritualRoot": [28, 36]
},
"Late": {
"lifespan": [155, 160],
"health": [1400, 1800],
"energy": [1200, 1600],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [28, 36],
"basewillpower": [26, 32],
"atk": [220, 270],
"def": [40, 55],
"crit": [14, 20],
"critres": [14, 20],
"agility": [30, 40],
"martialArts": [38, 50],
"spiritualRoot": [35, 45]
}
},
"Qi Condensation Realm": {
"Early": {
"lifespan": [165, 170],
"health": [1900, 2300],
"energy": [1700, 2100],
"luck": [15, 20],
"insight": [20, 26],
"basestrength": [30, 38],
"basewillpower": [28, 35],
"atk": [300, 380],
"def": [45, 65],
"crit": [12, 18],
"critres": [12, 18],
"agility": [35, 45],
"martialArts": [45, 60],
"spiritualRoot": [40, 55]
},
"Middle": {
"lifespan": [175, 185],
"health": [2400, 2900],
"energy": [2200, 2700],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [38, 48],
"basewillpower": [35, 44],
"atk": [380, 480],
"def": [60, 85],
"crit": [16, 24],
"critres": [16, 24],
"agility": [45, 58],
"martialArts": [58, 75],
"spiritualRoot": [52, 70]
},
"Late": {
"lifespan": [190, 210],
"health": [3000, 3800],
"energy": [2800, 3500],
"luck": [26, 36],
"insight": [34, 44],
"basestrength": [48, 60],
"basewillpower": [44, 55],
"atk": [480, 580],
"def": [80, 110],
"crit": [22, 30],
"critres": [22, 30],
"agility": [55, 70],
"martialArts": [72, 90],
"spiritualRoot": [65, 85]
}
},
"Foundation Establishment Realm": {
"Early": {
"lifespan": [220, 250],
"health": [4200, 5200],
"energy": [3800, 4600],
"luck": [28, 38],
"insight": [38, 50],
"basestrength": [55, 70],
"basewillpower": [50, 65],
"atk": [620, 750],
"def": [100, 135],
"crit": [25, 35],
"critres": [25, 35],
"agility": [65, 82],
"martialArts": [85, 110],
"spiritualRoot": [80, 105]
},
"Middle": {
"lifespan": [255, 290],
"health": [5400, 6800],
"energy": [4800, 5900],
"luck": [35, 48],
"insight": [48, 62],
"basestrength": [68, 85],
"basewillpower": [62, 78],
"atk": [760, 920],
"def": [130, 170],
"crit": [32, 45],
"critres": [32, 45],
"agility": [80, 100],
"martialArts": [105, 135],
"spiritualRoot": [100, 130]
},
"Late": {
"lifespan": [300, 350],
"health": [7000, 8800],
"energy": [6100, 7600],
"luck": [45, 60],
"insight": [60, 78],
"basestrength": [85, 105],
"basewillpower": [78, 95],
"atk": [930, 1120],
"def": [165, 215],
"crit": [40, 55],
"critres": [40, 55],
"agility": [98, 122],
"martialArts": [130, 165],
"spiritualRoot": [125, 160]
}
},
"Core Formation Realm": {
"Early": {
"lifespan": [380, 450],
"health": [9500, 12000],
"energy": [8500, 10500],
"luck": [50, 68],
"insight": [70, 90],
"basestrength": [110, 140],
"basewillpower": [100, 125],
"atk": [1250, 1550],
"def": [220, 290],
"crit": [48, 65],
"critres": [48, 65],
"agility": [120, 150],
"martialArts": [170, 215],
"spiritualRoot": [155, 200]
},
"Middle": {
"lifespan": [460, 550],
"health": [12500, 15800],
"energy": [11000, 13800],
"luck": [65, 85],
"insight": [88, 112],
"basestrength": [135, 170],
"basewillpower": [125, 155],
"atk": [1580, 1950],
"def": [280, 370],
"crit": [60, 80],
"critres": [60, 80],
"agility": [150, 185],
"martialArts": [210, 265],
"spiritualRoot": [195, 245]
},
"Late": {
"lifespan": [560, 700],
"health": [16500, 21000],
"energy": [14500, 18000],
"luck": [80, 105],
"insight": [110, 140],
"basestrength": [165, 210],
"basewillpower": [155, 190],
"atk": [1980, 2450],
"def": [360, 470],
"crit": [75, 100],
"critres": [75, 100],
"agility": [185, 230],
"martialArts": [260, 330],
"spiritualRoot": [240, 300]
}
},
"Nascent Soul Realm": {
"Early": {
"lifespan": [800, 1200],
"health": [24000, 31000],
"energy": [21000, 27000],
"luck": [95, 125],
"insight": [130, 170],
"basestrength": [220, 280],
"basewillpower": [200, 255],
"atk": [2700, 3400],
"def": [480, 620],
"crit": [90, 120],
"critres": [90, 120],
"agility": [240, 300],
"martialArts": [340, 430],
"spiritualRoot": [290, 370]
},
"Middle": {
"lifespan": [1300, 1800],
"health": [32000, 42000],
"energy": [28000, 36000],
"luck": [120, 160],
"insight": [165, 215],
"basestrength": [275, 350],
"basewillpower": [255, 320],
"atk": [3500, 4400],
"def": [610, 790],
"crit": [115, 150],
"critres": [115, 150],
"agility": [300, 375],
"martialArts": [430, 540],
"spiritualRoot": [360, 460]
},
"Late": {
"lifespan": [2000, 3000],
"health": [45000, 60000],
"energy": [39000, 52000],
"luck": [155, 210],
"insight": [210, 270],
"basestrength": [350, 440],
"basewillpower": [320, 400],
"atk": [4600, 5800],
"def": [780, 1000],
"crit": [145, 190],
"critres": [145, 190],
"agility": [380, 480],
"martialArts": [550, 700],
"spiritualRoot": [450, 580]
}
}
}>><div style="max-width:900px; margin:30px auto; line-height:1.9; font-size:1.05em; color:#e8e8e8;">
<h3 style="text-align:center; color:#ffd700; margin-bottom:30px; text-shadow:0 0 15px rgba(255,215,0,0.8); font-size:1.6em; letter-spacing:2px;">
◆ Interacting with <<print $currentNPC.fullname>> ◆
</h3>
<!-- Helper to persist changes -->
<<set _updateNPC = function() {
let idx = $known_npc_list.findIndex(n => n.id === $currentNPC.id);
if (idx !== -1) $known_npc_list[idx] = $currentNPC;
}>>
<!-- Helper for atmospheric transitions -->
<<set _getMood = function(npc) {
if (npc.friendship >= 80) return "warm";
if (npc.friendship >= 50) return "neutral";
if (npc.friendship >= 30) return "guarded";
return "distant";
}>>
<!-- Helper for reaction descriptions -->
<<set _getReaction = function(npc, type) {
let mood = _getMood(npc);
if (type === "greet") {
if (mood === "warm") return either("brightens visibly", "smiles softly", "offers you their full attention", "reaches toward you warmly");
if (mood === "neutral") return either("nods in acknowledgment", "greets you evenly", "regards you with interest", "inclines their head");
if (mood === "guarded") return either("eyes you cautiously", "offers a measured smile", "studies you carefully", "nods slightly");
return either("glances up coolly", "regards you distantly", "gives minimal acknowledgment", "maintains a careful distance");
}
return "shows interest";
}>>
<!-- ==================== TALK ==================== -->
<<if $relationAction is "talk">>
<p style="color:#d4af37; margin-bottom:15px;">
<<print $currentNPC.fullname>> <<print _getReaction($currentNPC, "greet")>>.
<<if $currentNPC.friendship gte 60>>
The aura around them seems to relax in your presence.
<<elseif $currentNPC.friendship lte 20>>
A faint barrier of qi hovers between you both.
<<else>>
Their demeanor remains composed yet observant.
<</if>>
</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"<<print either(
"You return to me... the heavens must smile upon my fortune.",
"Your visits bring light to even the darkest meditation.",
"Speak your heart. I find I wish to know your thoughts.",
"How... interesting that you seek me out again.",
"The sect feels less empty when you are near."
)>>"</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"<<print either(
"You show wisdom in seeking my counsel.",
"Another meeting between us... fate is clever.",
"Speak freely. Your words have begun to hold weight with me.",
"I sense you wish to share something. Proceed.",
"Your presence carries purpose. What drives you this time?"
)>>"</span></p>
<</if>>
<div id="talk-choices" style="margin-top:20px;">
<<link "💫 Discuss cultivation">>
<<replace "#talk-choices">>
<p style="margin:15px 0;">You settle into a comfortable posture, opening your inner sight to share insights about qi resonance, meridian pathways, and the subtle dance between intent and execution.</p>
<<if $currentNPC.friendship gte 70>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;"><<print $currentNPC.fullname>> leans forward with genuine interest, their eyes reflecting the glow of inner perception. They listen not as a superior, but as one who recognizes a kindred seeker.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"<<print either(
"You possess the rare gift of bridging knowledge and understanding. Your dantian resonates with potential—nurture it as one would a sacred flame.",
"The path you describe... I walked it once. Reverse circulation during the third watch brought my clarity. Trust in silence more than struggle.",
"The Dao does not rush. Those who demand swift ascension often stumble. You, however—you listen to the subtle currents. Continue as you are.",
"Your foundation is like carved jade—solid and true. What you lack is not strength but faith in what you have already become."
)>>"</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"<<print either(
"Few possess such balanced perspective. Your mind moves like water around obstacles rather than crashing against them like stone.",
"I sense you in my own breakthrough moments—that hunger tempered by patience. Rare. Precious. Guard it well.",
"The Dao opens itself not to the greedy but to those who listen. You listen well.",
"Your insight borders on enlightenment. Push past this threshold with gentle persistence, not force."
)>>"</span></p>
<</if>>
<<set $exp += 150>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(8,15))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +150 EXP gained. Profound connection deepened. <<print $currentNPC.fullname>> views you with new respect.</em></p>
<<elseif $currentNPC.friendship gte 40>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They listen with measured attention, occasionally nodding as recognition flickers across their features. A teacher's patience mingles with a seeker's curiosity.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Your approach shows promise. These techniques you mention—I recognize their lineage. You are on a sound path, though still early in your journey. Continue with diligence."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"The fundamentals you describe are solid. Your understanding is emerging, though much depth awaits beyond the horizon. Persist without haste."</span></p>
<</if>>
<<set $exp += 90>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(5,10))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +90 EXP gained. Friendship moderately increased.</em></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They listen with polite distance, their attention like moonlight—present but cool, neither warm nor dismissive.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Such matters are deeply personal. The Dao speaks differently to each seeker. You must find your own voice in its silence."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"These are your challenges to navigate. I do not doubt you will find your own answers."</span></p>
<</if>>
<<set $exp += 40>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(2,5))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +40 EXP gained.</em></p>
<</if>>
<</replace>>
<</link>>
<br>
<<link "🌙 Ask about their past">>
<<replace "#talk-choices">>
<p style="margin:15px 0;">You settle back, voice gentle and patient. "I sense depth in you—stories of trials and triumphs. Would you share some of your journey with me?"</p>
<<if $currentNPC.internalTrait is "Wicked" or $currentNPC.internalTrait is "Selfish" or $currentNPC.internalTrait is "Evil">>
<p style="margin:15px 0; font-style:italic; color:#8b0000;">A dark smile curves their lips, and the temperature around you seems to drop. Their eyes gleam with dangerous nostalgia.</p>
<p><span style="color:#ff1744;">"Ah, you wish to know the shape of my ascent? It is written in the bones of those who stood in my way. Power is not gifted—it is taken. I learned this lesson early and have never forgotten it. The weak are stones for the strong to stand upon."</span></p>
<<if $corruption lt 80>>
<p style="margin:15px 0; color:#d4af37;"><em>Their words carry the weight of genuine conviction, chilling and absolute.</em></p>
<</if>>
<<elseif $currentNPC.internalTrait is "Selfless" or $currentNPC.internalTrait is "Upstanding" or $currentNPC.internalTrait is "Kind">>
<p style="margin:15px 0; font-style:italic; color:#90EE90;">Warmth blooms in their expression. Their gaze turns inward, reflecting on memories both painful and precious.</p>
<p><span style="color:#87ceeb;">"I have walked a path of helping others because the suffering of innocents once nearly consumed me. I learned that true strength lies not in domination but in lifting others from darkness. The Dao rewards compassion with unexpected blessings."</span></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Their features grow thoughtful, caught between shadows and light.</p>
<p><span style="color:#d4af37;">"Life has taught me that neither absolute virtue nor absolute ambition brings peace. I walk between extremes, learning from both triumph and failure."</span></p>
<</if>>
<<if $currentNPC.externalTrait is "Vengeful">>
<p style="margin:15px 0; color:#8b0000;">Their hands clench slightly, and for a moment, killing intent flickers through the air like a sharp blade.</p>
<p><span style="color:#ff1744;">"Some debts cannot be settled by coin or apology. Some require the price of blood. I have enemies, and I will not rest until they understand the weight of their betrayals."</span></p>
<<elseif $currentNPC.externalTrait is "Romantic">>
<p style="margin:15px 0; color:#ff69b4;">Their expression softens into something achingly vulnerable. A wistful sadness crosses their features.</p>
<p><span style="color:#ff69b4;">"I loved once, truly and completely. That love shaped my ascension as much as any technique. Now... I carry that memory like a sword—beautiful and dangerous, never far from my heart."</span></p>
<<elseif $currentNPC.externalTrait is "Power-hungry">>
<p style="margin:15px 0; color:#ffd700;">Their eyes burn with barely contained ambition. The air thrums with their hunger for greater heights.</p>
<p><span style="color:#ffd700;">"Every realm I conquer is but a step toward the next. Power is truth—the only constant in a shifting world. I will ascend until the heavens themselves bow to my will."</span></p>
<<elseif $currentNPC.externalTrait is "Family-oriented">>
<p style="margin:15px 0; color:#ffc0cb;">Their features warm with genuine affection, and protective qi swirls around them unconsciously.</p>
<p><span style="color:#ff69b4;">"My clan is my anchor. Every strength I gain, every technique I master—these are for their protection and honor. Blood bonds transcend even the boundaries of death."</span></p>
<</if>>
<<set $currentNPC.talk += 1>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(6,12))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ Friendship increased. You glimpsed the soul beneath the cultivation.</em></p>
<</replace>>
<</link>>
<br>
<<link "💋 Flirt / Tease">>
<<replace "#talk-choices">>
<<if $currentNPC.depravity gte 40 or $currentNPC.friendship gte 60>>
<p style="margin:15px 0; font-style:italic; color:#d4af37;">You lean closer, voice dropping to something more intimate. Your eyes meet theirs with unmistakable intent, and the air between you crackles with new energy.</p>
<p style="margin:15px 0;"><<print $currentNPC.fullname>> <<print either(
"brushes a strand of hair from their face, eyes darkening",
"meets your gaze steadily, a knowing smile playing at their lips",
"blushes slightly, caught between amusement and something deeper",
"leans in closer, their breath warm"
)>>.</p>
<<if $currentNPC.depravity gte 75>>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"<<print either(
"You play with fire, knowing full well it will burn you... and I find I no longer wish to extinguish these flames.",
"Such boldness. Continue, and you may find yourself unable to leave this chamber.",
"Is that an invitation? Because I am very much inclined to accept it.",
"You are either very brave or very foolish. I cannot decide which excites me more."
)>>"</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"<<print either(
"Your boldness intoxicates me. Test my restraint further and face the consequences.",
"Such words from you... they ignite something within I thought long dormant.",
"You seem intent on unraveling my composure. Dangerous game.",
"I like your courage. Let us see how far you are willing to take this."
)>>"</span></p>
<</if>>
<<set $currentNPC.depravity = Math.min(100, $currentNPC.depravity + random(4,10))>>
<<elseif $currentNPC.depravity gte 50>>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"<<print either(
"You are... surprisingly forward. I do not mind.",
"Such intensity from you. My heart finds itself racing.",
"Perhaps there is more to you than meets the eye.",
"You are dangerous in ways that have nothing to do with cultivation."
)>>"</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"<<print either(
"Your boldness is intriguing. Proceed carefully.",
"This side of you... I find it compelling.",
"You surprise me. Continue.",
"Such boldness deserves acknowledgment."
)>>"</span></p>
<</if>>
<<set $currentNPC.depravity = Math.min(100, $currentNPC.depravity + random(3,7))>>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They pull back slightly, clearing their throat. Their expression remains kind but noticeably more reserved.</p>
<p><span style="color:#d4af37;">"You honor me with your attention, but perhaps we should maintain... propriety for now."</span></p>
<</if>>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Your attempt at seduction meets polite resistance. They respond with warmth, but it is the warmth of distant stars—beautiful but untouchable.</p>
<p><span style="color:#d4af37;">"Your company is treasured, but such intimacy requires deeper understanding between us."</span></p>
<</if>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(3,8))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ Friendship slightly increased.</em></p>
<</replace>>
<</link>>
</div>
<br><br>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<!-- ==================== BOND ==================== -->
<<elseif $relationAction is "bond">>
<p style="margin:15px 0; color:#d4af37;">You suggest spending time together—not in training or duty, but in genuine presence. Something precious and rare in the harsh world of cultivation.</p>
<<if $currentNPC.friendship gte 80>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;"><<print $currentNPC.fullname>>'s face brightens noticeably. They rise and take your hand without hesitation, qi flowing warm and welcoming.</p>
<p style="margin:15px 0; color:#90EE90;">Together, you share a quiet meal beneath ancient pines, where the wind carries the scent of distant mountains. As twilight paints the sky in shades of crimson and gold, you sit side by side, watching the stars ignite one by one. Your cultivations synchronize naturally—two flames burning in harmony rather than isolation.</p>
<p style="margin:15px 0; font-style:italic; color:#d4af37;">In this moment, the barriers between you dissolve. What emerges is something profound—a connection that transcends mere friendship. Trust, understanding, and genuine affection interweave like threads of silk.</p>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(18,28))>>
<<set $exp += 120>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +120 EXP gained. A bond has deepened beyond the mortal realm—sacred, unbreakable.</em></p>
<<elseif $currentNPC.friendship gte 40>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They pause, then nod with genuine interest. "I would welcome that," they say softly.</p>
<p style="margin:15px 0; color:#90EE90;">You walk together through the sect grounds as dusk settles. Conversation flows naturally between comfortable silences—stories of childhood, dreams half-formed, quiet observations about the nature of the Dao. Their laughter comes more freely than you have heard before, and your own heart feels lighter.</p>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(10,17))>>
<<set $exp += 75>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +75 EXP gained. Friendship moderately increased.</em></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They regard the offer with thoughtful hesitation, then offer a polite smile.</p>
<p><span style="color:#d4af37;">"Perhaps another time. We have not yet reached that threshold of closeness."</span></p>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(2,5))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ Friendship slightly increased.</em></p>
<</if>>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<!-- ==================== PARTNER ==================== -->
<<elseif $relationAction is "partner">>
<p style="margin:15px 0; color:#d4af37;">You lay bare your heart, proposing a bond beyond the ordinary—shared techniques, intertwined resources, a cultivation partnership where you rise together rather than in isolation.</p>
<<if $currentNPC.friendship gte 90 and $currentNPC.relationshipType isnot "enemy">>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">The words you feared never come. Instead, their eyes glimmer with profound emotion—something between joy and relief.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Yes. I have waited for someone brave enough to speak such words. I would be honored beyond measure to walk this path with you, through every realm and beyond."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"This is what my heart has hoped for. I would be honored to cultivate with you, to weather storms together, to share not just techniques but destiny itself."</span></p>
<</if>>
<<set $currentNPC.relationshipType to "partner">>
<<if not $playerRelations.lovers.includes($currentNPC.id)>>
<<set $playerRelations.lovers.push($currentNPC.id)>>
<</if>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ You are now cultivation partners! Profound unlocked—joint training, synchronization techniques, shared breakthroughs, and the possibility of perfect dual cultivation.</em></p>
<<elseif $currentNPC.friendship gte 60>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Emotion flickers across their features. They step closer, but uncertainty clouds their eyes.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Such an offer... yes, it tempts me deeply. But I must be certain. Give me time to know you as fully as you deserve to be known. Then, perhaps, this dream might become real."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Your words stir something in my heart. But partnership at this level requires absolute trust. Allow me more time to build that certainty with you."</span></p>
<</if>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + 12)>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ They are moved by your sincerity. Continue deepening your bond.</em></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They regard you with kindness, but shake their head gently.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Such intimacy requires a foundation we have not yet built. I cannot give my heart to one I do not fully trust."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Your feelings honor me, but partnership is a sacred vow. We are not yet ready for such promises."</span></p>
<</if>>
<</if>>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<!-- ==================== MENTORSHIP ==================== -->
<<elseif $relationAction is "mentorship">>
<<if $currentNPC.realm gt $cultivationRealm or $currentNPC.NPCmartialArts gt $martialArts + 20>>
<p style="margin:15px 0; color:#d4af37;">You bow deeply, qi humble and open. "I have much to learn, and I sense in you the wisdom of one who has walked further on this path. Would you guide me?"</p>
<<if $currentNPC.friendship gte 70 and ($currentNPC.internalTrait is "Kind" or $currentNPC.internalTrait is "Upstanding" or $currentNPC.internalTrait is "Selfless")>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Their expression transforms into something warm and purposeful. They place a hand on your shoulder, and you feel ancient knowledge humming beneath their touch.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"It would be my privilege. I see in you the seeds of greatness. Allow me to help them bloom."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"This is the path I have long hoped to walk. Your potential calls to me. I will teach you not just techniques, but the deeper truths behind them."</span></p>
<</if>>
<<set $currentNPC.mentorshipType to 1>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ You have gained a Master! They will unlock advanced techniques, offer breakthrough guidance, and share secrets of the Dao.</em></p>
<<if not $playerRelations.masters.includes($currentNPC.id)>>
<<set $playerRelations.masters.push($currentNPC.id)>>
<</if>>
<<if not $currentNPC.relations.apprentices.includes("player")>>
<<set $currentNPC.relations.apprentices.push("player")>>
<</if>>
<<elseif $currentNPC.friendship gte 50>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They consider your request seriously, then offer a subtle nod.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Very well. I see promise in you worth cultivating. Prepare yourself to learn with discipline and respect."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"I will teach you. Whether you can truly learn is another matter entirely. We shall see."</span></p>
<</if>>
<<set $currentNPC.mentorshipType to 1>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ You have gained a Mentor! Training begins.</em></p>
<<if not $playerRelations.masters.includes($currentNPC.id)>>
<<set $playerRelations.masters.push($currentNPC.id)>>
<</if>>
<<if not $currentNPC.relations.apprentices.includes("player")>>
<<set $currentNPC.relations.apprentices.push("player")>>
<</if>>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They study you with a measuring gaze, then shake their head slowly.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"I do not accept students lightly. First, you must prove yourself worthy of my time."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Mentorship is earned, not granted. Return when you have demonstrated true dedication."</span></p>
<</if>>
<</if>>
<<else>>
<p style="margin:15px 0; color:#d4af37;">You offer to guide them in the Dao, positioning yourself as the senior in this relationship.</p>
<<if $currentNPC.friendship gte 60 and $currentNPC.realm lt $cultivationRealm>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They bow deeply, eyes bright with respect and gratitude.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"This junior would be deeply honored to receive guidance from such a powerful cultivator. I will learn with utmost diligence."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"I am grateful for your generosity. I will not waste this opportunity."</span></p>
<</if>>
<<set $currentNPC.mentorshipType to 2>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ You have accepted an Apprentice! Nurture their growth and strengthen your own mastery.</em></p>
<<if not $playerRelations.apprentices.includes($currentNPC.id)>>
<<set $playerRelations.apprentices.push($currentNPC.id)>>
<</if>>
<<if not $currentNPC.relations.masters.includes("player")>>
<<set $currentNPC.relations.masters.push("player")>>
<</if>>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">They offer a polite but firm decline.</p>
<p><span style="color:#d4af37;">"Your offer is gracious, but I must pursue my own path for now."</span></p>
<</if>>
<</if>>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<!-- ==================== GIFT ==================== -->
<<elseif $relationAction is "gift">>
<p style="margin:15px 0; color:#d4af37;">You present an offering, carefully chosen to resonate with their nature and values.</p>
<<if $currentNPC.externalTrait is "Glory hound">>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">You select something impressive and public-worthy. They accept with obvious pleasure, already imagining how it will enhance their reputation.</p>
<p><span style="color:#ffd700;">"A gift befitting one of my standing. Excellent choice."</span></p>
<<elseif $currentNPC.externalTrait is "Family-oriented">>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">You choose something that honors family—a protection charm, a precious stone from a sacred peak, or knowledge of a technique that strengthens bloodlines.</p>
<p><span style="color:#ff69b4;">"This... this will have a place of honor in our family shrine. You understand what matters most to me."</span></p>
<<elseif $currentNPC.externalTrait is "Romantic">>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Your gift carries beauty and meaning—perhaps a rare flower that blooms once in a century, or a handwritten poem that touches their heart.</p>
<p><span style="color:#ff69b4;">Their eyes soften, glistening slightly. "This is... truly beautiful. You have given me far more than an object. You have given me a memory I will cherish."</span></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">You present something thoughtfully chosen. They receive it with genuine warmth.</p>
<p><span style="color:#d4af37;">"Your thoughtfulness is evident. I will treasure this."</span></p>
<</if>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(12,28))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ Friendship greatly increased.</em></p>
<<if $currentNPC.depravity gte 60 and $corruption gte 40>>
<p style="margin:15px 0; font-style:italic; color:#8b0000;">As they admire the gift, their gaze lingers on you with sudden intensity. Something darker awakens in their expression—hunger of a nature neither purely virtuous nor entirely innocent.</p>
<p><span style="color:#ff1744;">"Your gift awakens certain... appetites within me. How interesting."</span></p>
<<set $currentNPC.depravity = Math.min(100, $currentNPC.depravity + random(3,8))>>
<<run _updateNPC()>>
<</if>>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<!-- ==================== SPAR ==================== -->
<<elseif $relationAction is "spar">>
<p style="margin:15px 0; color:#d4af37;">You challenge <<print $currentNPC.fullname>> to a duel, voice carrying respect rather than arrogance.</p>
<<if $currentNPC.friendship gte 50 or $currentNPC.externalTrait is "Glory hound">>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"At last! I have longed to test myself against you. Show me your strength!"</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Your challenge honors me. I accept—let us see what we are truly made of."</span></p>
<</if>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">The world narrows to a single moment. You both step into a clearing where the space between you becomes a battlefield of pure potential.</p>
<p style="margin:15px 0; color:#d4af37;">Techniques clash in brilliant succession. Your weapon sings against theirs—sparks of qi dance like captured starlight. Sweat mingles with the heat of cultivation, and every breath comes heavy with exertion. The exchange is neither dance nor violence, but something sacred—two cultivators expressing their essence through combat.</p>
<<set _playerPower = $martialArts + random(1,35)>>
<<set _npcPower = $currentNPC.NPCmartialArts + random(1,35)>>
<<if _playerPower gte _npcPower>>
<p style="margin:15px 0; font-style:italic; color:#90EE90;">In the final exchange, your technique flows perfectly. You emerge victorious. Your opponent staggers back, breathing hard, then begins to laugh—a genuine, delighted sound.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"Magnificent! You have grown far stronger. I am not ashamed to yield to you. This victory is earned."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Well fought. I see now why others speak of your potential with such reverence. You may indeed surpass me one day."</span></p>
<</if>>
<<set $exp += 180>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +180 EXP gained.</em></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#d4af37;">Their superior technique gradually overwhelms yours. You find yourself retreating, adapting, learning with each failed counter. Finally, they catch your weapon and hold, victory absolute yet without cruelty.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"You fought beautifully. Your foundation is solid—what you lack is refinement. With time and dedication, you will reach heights you cannot yet imagine."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"You have skill and determination. This defeat is not failure—it is knowledge. Learn from it, and return stronger."</span></p>
<</if>>
<<set $exp += 140>>
<<if random(1,2) is 1>>
<<set $insight += 1>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +140 EXP gained. +1 Insight gained from glorious defeat.</em></p>
<<else>>
<<set $martialArts += 1>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +140 EXP gained. +1 Martial Arts mastery.</em></p>
<</if>>
<</if>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(10,20))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:20px;"><em>✦ Friendship increased. A bond forged through honorable combat.</em></p>
<<else>>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"I do not engage in combat lightly. Prove yourself more worthy first."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Perhaps when we are better acquainted. I do not wish to injure a friend."</span></p>
<</if>>
<</if>>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<!-- ==================== DUAL CULTIVATION ==================== -->
<<elseif $relationAction is "dualCultivation">>
<div class="interaction-scene">
<<if $currentNPC.friendship gte 85 and $currentNPC.depravity gte 50 or ($currentNPC.relationshipType is "partner" or $currentNPC.relationshipType is "lover")>>
<p>The air between you crackles. You suggest merging qi in the most intimate way possible—not merely cultivation, but a complete joining of body, power, and will. Your eyes communicate everything: desire, possession, need.</p>
<<if $currentNPC.depravity gte 85>>
<<if $currentNPC.gender is "female">>
<p><span class="female">"Finally. My body has been burning for this since the moment I first felt your touch. I want every inch of you inside me while our qi merges. I want to scream your name as you make me come, over and over."</span></p>
<p>She pulls you into her private chamber, tearing at your robes with desperate hunger. She's liquid grace and controlled violence as she pushes you backward, her strength matching yours. Her hands grip you possessively as she whispers filthy promises against your skin.</p>
<<else>>
<p><span class="male">"I have been thinking about nothing but this—your body, your submission, the way you will feel wrapped around my cock while our powers merge. I want to claim every part of you."</span></p>
<p>He takes you with the intensity of someone who has been restraining themselves for far too long. His possession is clear, his hunger absolute. He positions you exactly as he wants, his control making it clear this is about mastery as much as pleasure.</p>
<</if>>
<<set $sexPartner to $currentNPC>>
<<set $sexType to "consensual_seduce">>
<<set $sexReturnPassage to "RelationsDetailed">>
<<link "Continue" "EncounterInteractionSex">><</link>>
<<elseif $currentNPC.depravity gte 70>>
<<if $currentNPC.gender is "female">>
<p><span class="female">"Yes. Let us merge completely. I want to feel you deep inside me, our qi flowing as one. Take me however you desire."</span></p>
<<else>>
<p><span class="male">"Yes. I want this more than cultivation itself. I want to feel your body, to be inside you, our powers ascending together."</span></p>
<</if>>
<<set $sexPartner to $currentNPC>>
<<set $sexType to "consensual_seduce">>
<<set $sexReturnPassage to "RelationsDetailed">>
<<link "Continue" "EncounterInteractionSex">><</link>>
<<else>>
<<if $currentNPC.gender is "female">>
<p><span class="female">"I want this. You. Let us ascend together with passion and reverence."</span></p>
<<else>>
<p><span class="male">"Let us merge our spirits in the most intimate way. You mean everything to me."</span></p>
<</if>>
<<set $sexPartner to $currentNPC>>
<<set $sexType to "consensual_seduce">>
<<set $sexReturnPassage to "RelationsDetailed">>
<<link "Continue" "EncounterInteractionSex">><</link>>
<</if>>
<<elseif $currentNPC.friendship gte 75 and $currentNPC.depravity gte 60>>
<p>You suggest dual cultivation, your voice heavy with desire and intention.</p>
<p>The suggestion hangs in the air. <<print $currentNPC.fullname>>'s eyes darken intensely, their breathing deepens. They step closer, and you can feel the heat radiating from them.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female">"The idea makes my entire body ache with need. But we are not quite there yet. When we are partners in truth, we will do this—and it will break us both apart and remake us as one. Give me just a little more time."</span></p>
<<else>>
<p><span class="male">"I want that desperately. My body is responding to the mere thought. Soon—very soon—I will make you completely mine. Until then, your anticipation is exquisite torture."</span></p>
<</if>>
<<set $currentNPC.depravity += random(8,16)>>
<<set $currentNPC.friendship += random(12,20)>>
<p><strong style="color:#FFD700;">Friendship +<<print random(12,20)>> | Depravity +<<print random(8,16)>></strong></p>
<<elseif $currentNPC.friendship gte 60 and $currentNPC.depravity gte 50>>
<p>You suggest dual cultivation. <<print $currentNPC.fullname>>'s pupils dilate, and there's a moment where you can see raw desire war with their better judgment.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female">"I want to. So badly. But not yet—let us be certain first. The promise of what we will do together... that alone is enough to keep me going."</span></p>
<<else>>
<p><span class="male">"You tempt me beyond measure. But I need our bond to be absolute first. When the time comes, I will be completely yours."</span></p>
<</if>>
<<set $currentNPC.depravity += random(6,12)>>
<<set $currentNPC.friendship += random(8,15)>>
<p><strong style="color:#90EE90;">Friendship +<<print random(8,15)>> | Depravity +<<print random(6,12)>></strong></p>
<<else>>
<p>You suggest dual cultivation. <<print $currentNPC.fullname>> steps back, clearly uncomfortable with the directness of the proposition.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female">"Such intimacy requires far deeper connection and trust than we currently share. Please, do not ask this of me again until we have built something real."</span></p>
<<else>>
<p><span class="male">"I am honored by your desire, but such intimacy is sacred to me. Only when true trust and affection exist between us."</span></p>
<</if>>
<<set $currentNPC.friendship -= random(3,8)>>
<<set $currentNPC.depravity -= random(2,5)>>
<p><em>That may have been far too premature. They seem genuinely upset.</em></p>
<</if>>
</div>
<<link "Return" "RelationsDetailed">><<set $relationAction to null>><</link>>
<!-- ==================== DEBATE ==================== -->
<<elseif $relationAction is "debate">>
<p style="margin:15px 0; color:#d4af37;">You invite them into philosophical discourse—a clash of perspectives on the nature of the Dao, the right path for a cultivator, the balance between ambition and acceptance.</p>
<<if $currentNPC.NPCinsight gte $insight + 15>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Their arguments flow like water around stone, each point cutting deeper than the last. Your logic, though sound, finds itself outmaneuvered by understanding that seems to come from a level beyond mere intellect.</p>
<p style="margin:15px 0; color:#d4af37;">Defeat settles around you, but it is a gift. In losing, you gain perspective you could never have found alone. Their wisdom opens doors in your mind you did not know existed.</p>
<<set $insight += random(2,4)>>
<<set $exp += 110>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +110 EXP gained. +2-4 Insight increased. Enlightenment comes through noble defeat.</em></p>
<<elseif $insight gte $currentNPC.NPCinsight + 15>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">Your logic unfolds flawlessly, each argument building upon the last like an unshakeable edifice. You watch their certainty gradually shift, their defenses carefully dismantled by reason rather than aggression.</p>
<p style="margin:15px 0; color:#d4af37;">When they finally concede, there is no shame in it—only respect. They nod slowly, genuinely moved by your perspective.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female" style="color:#ff69b4;">"You have bested me through wisdom, not dominance. I bow to your greater understanding. This is a gift I will treasure."</span></p>
<<else>>
<p><span class="male" style="color:#87ceeb;">"Few have ever turned my own philosophy against me so effectively. You have earned my profound respect."</span></p>
<</if>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(12,22))>>
<<set $exp += 160>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +160 EXP gained. Friendship greatly increased.</em></p>
<<else>>
<p style="margin:15px 0; font-style:italic; color:#c9a961;">A fierce and genuine exchange unfolds. Points are made and conceded, questions asked and answered. Neither emerges victorious, but both emerge transformed.</p>
<p style="margin:15px 0; color:#d4af37;">As the debate concludes, you both sit in satisfied silence—the profound kind that comes from being truly understood and challenged by another.</p>
<<set $exp += 130>>
<<set $currentNPC.friendship = Math.min(100, $currentNPC.friendship + random(5,10))>>
<<run _updateNPC()>>
<p style="color:#90EE90; margin-top:15px;"><em>✦ +130 EXP gained. Mutual understanding deepened.</em></p>
<</if>>
<<link "← Return">><<goto "RelationsDetailed">><</link>>
<</if>>
</div><<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<<else>>
<i>I should probably put some clothes on ...</i>
<</if>>
<<nobr>>
<<if $equippedRobe.class eq "naked">>
<p style="color:#8b0000; font-weight:bold;">There's no way I'm gonna talk to anyone naked!</p>
<<else>>
<<set $currentNPC to []>>
<<set $relationTab to $relationTab || "met">>
<<set $relationPage to $relationPage || 1>>
<<set _pageSize to 4>>
<div class="relations-container">
<h2 class="relations-title">Book of Connections</h2>
<p class="relations-subtitle">Fated encounters across the myriad realms...</p>
<!-- TAB NAVIGATION -->
<div class="relation-tabs">
<<link "Known (Met)">>
<<set $relationTab to "met">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<link "Discovered (Unmet)">>
<<set $relationTab to "unmet">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<link "Deceased">>
<<set $relationTab to "dead">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<link "All">>
<<set $relationTab to "all">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
</div>
<!-- Always include the grid container (empty message is handled by the widget) -->
<div class="relations-grid">
<<include "RelationsGrid">>
</div>
<!-- Always include pagination container -->
<div class="pagination-container">
<<include "RelationsPagination">>
</div>
</div>
<</if>>
<</nobr>><<link "Go back" $passage>><</link>>
<<nobr>>
<!-- SAFETY: If no ID selected, go back -->
<<if !$selectedNPCid>>
<<goto "Relations">>
<</if>>
<!-- Fetch the real NPC from list -->
<<set _npcIndex to $known_npc_list.findIndex(function(n) { return n.id is $selectedNPCid; })>>
<<if _npcIndex lt 0>>
<p style="color:red;">This connection no longer exists.</p>
<<goto "Relations">>
<</if>>
<<set $currentNPC to $known_npc_list[_npcIndex]>>
<<if $treeVisible is undefined>>
<<set $treeVisible = false>>
<</if>>
<div style="text-align:center; margin:15px 0;">
<<if $treeVisible>>
<<link "🌳 Hide Family Tree" "RelationsDetailed">>
<<set $treeVisible = false>>
<</link>>
<<else>>
<<link "🌳 Show Family Tree" "RelationsDetailed">>
<<set $treeVisible = true>>
<<DrawConnectionMap $currentNPC>>
<</link>>
<</if>>
</div>
<div id="tree-container">
<<if $treeVisible>>
<<DrawConnectionMap $currentNPC>>
<</if>>
</div>
<div class="relation-detail-container">
<div class="relation-header">
<img @src="'images/NPC/' + $currentNPC.gender + '/' + $currentNPC.npcPortrait + '.webp'" class="relation-portrait" alt="<<print $currentNPC.fullname>>">
<div class="relation-basics">
<h3><<print $currentNPC.fullname>>
<<if $currentNPC.isDead>> <span style="color:#8b0000; font-size:0.8em;">(Deceased)</span><</if>>
</h3>
<p><strong>Sex:</strong> <<print $currentNPC.gender>> •
<<if $currentNPC.isDead>>
<strong>Lifespan at death:</strong> <<print $currentNPC.NPClifespan>> / <<print $currentNPC.NPCmaxlifespan>>
<<else>>
<strong>Lifespan:</strong> <<print $currentNPC.NPClifespan>> / <<print $currentNPC.NPCmaxlifespan>>
<</if>></p>
<p><strong>Realm:</strong> <<print $currentNPC.realm>> • <strong>Position:</strong> <<print $currentNPC.NPCrank>> of <<print $currentNPC.sectNPC>></p>
<p><strong>Traits:</strong> <<print $currentNPC.internalTrait>> • <<print $currentNPC.externalTrait>></p>
<<if !$currentNPC.isDead>>
<p><strong>Location:</strong> <<print $currentNPC.NPClocation>></p>
<</if>>
<p><strong>Relationship:</strong> <<print $currentNPC.relationshipType>></p>
</div>
</div>
<<if $currentNPC.hasGrudge and !$currentNPC.isDead>>
<<set _grudgeInfo to $activeGrudges.find(function(g) { return g.avengerId === $currentNPC.id and g.active; })>>
<<if _grudgeInfo>>
<div class="grudge-warning">
<span class="red-text">⚠️ This cultivator holds a grudge against you! ⚠️</span><br>
<<if _grudgeInfo.type eq "rape">>
They seek vengeance for defiling <<print _grudgeInfo.victimName>>.
<<elseif _grudgeInfo.type eq "murder">>
They seek vengeance for the death of <<print _grudgeInfo.victimName>>.
<<elseif _grudgeInfo.type eq "seduction">>
They harbor jealousy over <<print _grudgeInfo.victimName>>.
<<elseif _grudgeInfo.type eq "humiliation">>
They seek to restore their honor after your insult.
<<else>>
They seek justice for your transgression.
<</if>>
<span class="small-text">(Seething with fury)</span>
</div>
<</if>>
<</if>>
<<if !$currentNPC.isDead>>
<<NPCMeter $currentNPC.friendship 100 "Friendship" "#4287f5">>
<<NPCMeter $currentNPC.depravity 100 "Depravity" "#a042f5">>
<</if>>
<p class="relation-flavor">
<<if $currentNPC.isDead>>
<!-- Dead NPC: check for custom death -->
<<if $currentNPC.killedByPlayer>>
<<if $currentNPC.killedInRevenge>>
You ended the life of <<print $currentNPC.fullname>>, who sought vengeance for
<<if $currentNPC.deathGrudgeVictim>>
<<print $currentNPC.deathGrudgeVictim>>
<<else>>
a perceived wrong
<</if>>.
Their blood is on your hands.
<<else>>
You slew <<print $currentNPC.fullname>> in battle. Their spirit may yet seek justice.
<</if>>
<<else>>
<!-- Default death flavor texts (modified to include cause if known) -->
<<set _deadFlavors to []>>
<<if $currentNPC.deathCause eq "old_age">>
<<set _deadFlavors = [
`${$currentNPC.fullname} passed peacefully of old age at ${$currentNPC.NPClocation}.`,
`The jianghu remembers ${$currentNPC.fullname}, who died of natural causes in ${$currentNPC.NPClocation}.`,
`Time claimed ${$currentNPC.fullname} in ${$currentNPC.NPClocation}. Their legend fades but is not forgotten.`
]>>
<<elseif $currentNPC.deathCause eq "murder">>
<<set _deadFlavors = [
`${$currentNPC.fullname} met a violent end at ${$currentNPC.NPClocation}. Whispers say they were ambushed.`,
`A bloodstained jade slip arrived from ${$currentNPC.NPClocation}: ${$currentNPC.fullname} was murdered.`,
`The cultivators of ${$currentNPC.NPClocation} speak of ${$currentNPC.fullname}'s untimely demise with hushed voices.`
]>>
<<else>>
<<set _deadFlavors = [
`The memory of ${$currentNPC.fullname} lingers like incense smoke... they passed from this world at ${$currentNPC.NPClocation}.`,
`A grave somewhere in ${$currentNPC.NPClocation} marks where ${$currentNPC.fullname} fell. Their story continues only in whispers.`,
`The Jianghu moves on, but ${$currentNPC.fullname}'s absence is still felt. They perished at ${$currentNPC.NPClocation}.`,
`Rumors say ${$currentNPC.fullname} met their end at ${$currentNPC.NPClocation}. Some speak of unfinished business...`,
`The soul of ${$currentNPC.fullname} has departed. Only echoes remain where they once walked in ${$currentNPC.NPClocation}.`,
`Ancestral tablets now bear ${$currentNPC.fullname}'s name. They fell at ${$currentNPC.NPClocation}.`,
`The spot where ${$currentNPC.fullname} died at ${$currentNPC.NPClocation} is said to be haunted by their lingering qi.`
]>>
<</if>>
<<print _deadFlavors.random()>>
<</if>>
<<else>>
<!-- Living NPC flavor texts (unchanged) -->
<<set _livingFlavors to [
`You've heard that ${$currentNPC.fullname} is currently at ${$currentNPC.NPClocation}.`,
`Word on the wind says ${$currentNPC.fullname} was last seen near ${$currentNPC.NPClocation}.`,
`Travelers mention spotting ${$currentNPC.fullname} around ${$currentNPC.NPClocation}.`,
`Rumors place ${$currentNPC.fullname} somewhere in ${$currentNPC.NPClocation}.`,
`A merchant claims to have traded with ${$currentNPC.fullname} recently at ${$currentNPC.NPClocation}.`,
`The spiritual energy near ${$currentNPC.NPClocation} bears traces of ${$currentNPC.fullname}'s presence.`,
`Someone matching ${$currentNPC.fullname}'s description was seen entering ${$currentNPC.NPClocation}.`
]>>
<<print _livingFlavors.random()>>
<</if>>
</p>
<!-- Only show interaction buttons if NPC is alive AND in same region -->
<<if !$currentNPC.isDead and $region eq $currentNPC.NPClocation>>
<div class="tab-nav">
<<link "Talk">><<goto "Relations Interactions">><<set $relationAction to "talk">><</link>>
<<link "Bond">><<goto "Relations Interactions">><<set $relationAction to "bond">><</link>>
<<link "Partner">><<goto "Relations Interactions">><<set $relationAction to "partner">><</link>>
<<link "Mentorship">><<goto "Relations Interactions">><<set $relationAction to "mentorship">><</link>>
<<link "Gift">><<goto "Relations Interactions">><<set $relationAction to "gift">><</link>>
<<link "Spar">><<goto "Relations Interactions">><<set $relationAction to "spar">><</link>>
<<link "Dual Cultivation">><<goto "Relations Interactions">><<set $relationAction to "dualCultivation">><</link>>
<<link "Debate">><<goto "Relations Interactions">><<set $relationAction to "debate">><</link>>
</div>
<<elseif $currentNPC.isDead>>
<!-- Memorial interactions for dead NPCs -->
<div class="memorial-actions" style="text-align:center; margin:20px 0; padding:15px; background:rgba(139,0,0,0.1); border-radius:10px;">
<p style="color:#8b0000; font-style:italic;">
<<= [
"You can only visit their grave and pay respects...",
"Their spirit has departed. Only memories remain.",
"The living must honor the dead through remembrance.",
"Perhaps one day you'll avenge them...",
"Their unfinished business calls to you from beyond."
].random() >>
</p>
<<linkreplace "Pay Respects">>
<<set $currentNPC.friendship to 100>>
<<set $exp += 5>>
<span style="color:#ffd700;">You honor their memory. +5 EXP</span>
<</linkreplace>>
</div>
<</if>>
<<if $NpcStatsVisible is undefined>>
<<set $NpcStatsVisible = false>>
<</if>>
<div style="text-align:center; margin:15px 0;">
<<if $NpcStatsVisible>>
<<link "Hide stats" "RelationsDetailed">>
<<set $NpcStatsVisible = false>>
<</link>>
<<else>>
<<link "Show stats" "RelationsDetailed">>
<<set $NpcStatsVisible = true>>
<<BookOfConnections_npcStats>>
<</link>>
<</if>>
</div>
<div id="stats-container">
<<if $NpcStatsVisible>>
<<BookOfConnections_npcStats>>
<</if>>
</div>
<div style="text-align:center; margin-top:30px;">
<<link "Return to Connections">><<goto "Relations">><</link>>
</div>
</div>
<</nobr>><<nobr>>
<<set _tab to $relationTab || "met">>
<!-- Filter based on selected tab -->
<<if _tab eq "met">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === true and !n.isDead)>>
<<elseif _tab eq "unmet">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === false and !n.isDead)>>
<<elseif _tab eq "dead">>
<<set _filteredList to $known_npc_list.filter(n => n.isDead === true)>>
<<else>>
<<set _filteredList to $known_npc_list>>
<</if>>
<<set _pageSize to 4>>
<<set _page to $relationPage || 1>>
<<set _totalPages to Math.ceil(_filteredList.length / _pageSize)>>
/* Ensure page is valid */
<<if _totalPages > 0>>
<<if _page > _totalPages>>
<<set _page to _totalPages>>
<<set $relationPage to _page>>
<</if>>
<<else>>
<<set _page to 1>>
<<set $relationPage to 1>>
<</if>>
<<if _page < 1>>
<<set _page to 1>>
<<set $relationPage to 1>>
<</if>>
<<set _start to (_page - 1) * _pageSize>>
<<set _end to Math.min(_start + _pageSize, _filteredList.length)>>
<<set _displayList to _filteredList.slice(_start, _end)>>
<<if _displayList.length gt 0>>
<<for _npc range _displayList>>
<<capture _npc>>
<div @class="'relation-card' + (_npc.isDead ? ' dead-card' : '')">
<div class="relation-name">
<<link _npc.fullname "RelationsDetailed">><<set $selectedNPCid to _npc.id>><</link>>
<<if _npc.isDead>> <span style="color:#8b0000;">✟</span><</if>>
</div>
<div class="relation-info">
<span class="location"><<print _npc.NPClocation>></span><br>
<<if !_npc.isMet and !_npc.isDead>>
<span style="color:#819ca9;">(Discovered but not met)</span><br>
<</if>>
<<RelationshipType>>
</div>
<<if !_npc.isDead>>
<<link "Forget this connection">>
<<RemoveNPC>>
<<goto "Relations">>
<</link>>
<</if>>
</div>
<</capture>>
<</for>>
<<else>>
<p style="text-align:center; color:#819ca9; font-style:italic; grid-column:span 3; padding:40px;">
<<if _tab eq "met">>You haven't met anyone yet...<<elseif _tab eq "unmet">>No discovered connections...<<elseif _tab eq "dead">>No one has passed from this world yet...<<else>>The book is empty...<</if>>
</p>
<</if>>
<</nobr>><<nobr>>
<<set _tab to $relationTab || "met">>
<!-- Filter based on selected tab -->
<<if _tab eq "met">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === true and !n.isDead)>>
<<elseif _tab eq "unmet">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === false and !n.isDead)>>
<<elseif _tab eq "dead">>
<<set _filteredList to $known_npc_list.filter(n => n.isDead === true)>>
<<else>>
<<set _filteredList to $known_npc_list>>
<</if>>
<<set _pageSize to 4>>
<<set _page to $relationPage || 1>>
<<set _totalPages to Math.ceil(_filteredList.length / _pageSize)>>
<!-- Ensure page is within bounds -->
<<if _page > _totalPages and _totalPages > 0>>
<<set _page to _totalPages>>
<<set $relationPage to _page>>
<</if>>
<!-- Show count info -->
<div style="text-align:center; color:#819ca9; font-size:0.9em; margin-bottom:10px;">
Showing <<= _filteredList.length >> connection<<if _filteredList.length != 1>>s<</if>>
<<if _totalPages > 1>> (Page <<= _page >> of <<= _totalPages >>)<</if>>
</div>
<!-- Pagination controls - always visible if multiple pages -->
<<if _totalPages > 1>>
<div style="display:flex; justify-content:center; align-items:center; gap:20px;">
<<if _page > 1>>
<<link "« Previous">>
<<set $relationPage to _page - 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<else>>
<span style="color:#555;">« Previous</span>
<</if>>
<span>Page <<= _page >> of <<= _totalPages >></span>
<<if _page < _totalPages>>
<<link "Next »">>
<<set $relationPage to _page + 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<else>>
<span style="color:#555;">Next »</span>
<</if>>
</div>
<<elseif _filteredList.length gt 0>>
<!-- Single page, show simple indicator -->
<div style="text-align:center; color:#555;">
<span style="color:#555;">« Previous</span>
<span style="margin:0 20px;">Page 1 of 1</span>
<span style="color:#555;">Next »</span>
</div>
<</if>>
<</nobr>><img src="images/Locations/BloodSandReach.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<<set $region to "Blood Sand Reach">>
<<link "Hunt demonic beasts" "HuntBeasts|Region1">><<set $passage to passage()>><</link>>
<br>
<<link "Gather herbs" "HerbGatherLoop|BloodSandReach">><</link>>
<br>
<<link "Exit Blood Sand Reach" "Map|Region1">><<set $passage to passage()>><</link>><<set $loopPassage to passage()>>
<<set $region to "Blood Sand Reach">>
<img src="images/Character/herb_gather.png" class="location-bg" style="width:40%; border: 1px solid #c5a059; border-radius: 0;">
<h3>Blood Sand Reach — Gathering</h3>
<p>You crouch low and begin searching the cracked earth and dry scrub for anything worth taking.</p>
<<HerbGather>>
<br>
<<if _eventRoll lte 70>>
<<link "Keep gathering" "HerbGatherLoop|BloodSandReach">><</link>>
<br>
<<link "Return to Blood Sand Reach" "Blood Sand Reach">><</link>>
<</if>><img src="images/Locations/GreatPlains.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<<set $region to "Great Plains">>
<<link "Hunt demonic beasts" "HuntBeasts|Region1">><<set $passage to passage()>><</link>>
<br>
<<link "Gather herbs" "HerbGatherLoop|GreatPlains">><</link>>
<br>
<<link "Exit Great Plains" "Map|Region1">><<set $passage to passage()>><</link>><<set $region to "Hundred Sorrows Mountain">>
<<set $loopPassage to passage()>>
<img src="images/Character/herb_gather.png" class="location-bg" style="width:40%; border: 1px solid #c5a059; border-radius: 0;">
<h3>Great Plains — Gathering</h3>
<p>You pick your way carefully along the rocky slope, eyes scanning the crevices and frozen pools for spirit herbs.</p>
<<HerbGather>>
<<if _eventRoll lte 70>>
<br>
<<link "Keep gathering" "HerbGatherLoop|GreatPlains">><</link>>
<br>
<<link "Return to Great Plains" "Great Plains">><</link>>
<</if>><img src="images/Locations/HundredSorrowsMountain.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<<set $region to "Hundred Sorrows Mountain">>
<<link "Hunt demonic beasts" "HuntBeasts|Region1">><<set $passage to passage()>><</link>>
<br>
<<link "Gather herbs" "HerbGatherLoop|HundredSorrows">><</link>>
<br>
<<link "Exit Hundred Sorrows Mountain" "Map|Region1">><<set $passage to passage()>><</link>><<set $region to "Hundred Sorrows Mountain">>
<<set $loopPassage to passage()>>
<img src="images/Character/herb_gather.png" class="location-bg" style="width:40%; border: 1px solid #c5a059; border-radius: 0;">
<h3>Hundred Sorrows Mountain — Gathering</h3>
<p>You pick your way carefully along the rocky slope, eyes scanning the crevices and frozen pools for spirit herbs.</p>
<<HerbGather>>
<<if _eventRoll lte 70>>
<br>
<<link "Keep gathering" "HerbGatherLoop|HundredSorrows">><</link>>
<br>
<<link "Return to Hundred Sorrows Mountain" "Hundred Sorrows Mountain">><</link>>
<</if>><div style="text-align:center;">
<h2 class="town-title">翡翠溪镇</h2> <div style="font-size: 0.9em; color: #c5a059; margin-top:-5px;">— Jade Creek Town —</div>
<img src="images/Locations/JadeCreekTown.jpg" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
</div>
<<set $PlayerLocation to passage()>>
<<nobr>>
<<set $city to passage(), $passage to passage(), $pe to 0>>
<<if $health lte 0>><<set $health to 1>><</if>>
/* Mini HUD Bar inside the same width as the grid */
<div style="max-width:400px; margin: 10px auto; display: flex; justify-content: space-between; font-size: 0.75em; border-bottom: 1px solid rgba(197, 160, 89, 0.4); padding-bottom: 3px;">
<span><span style="color:#d4af37;">◈</span> Spirit Stones: $gold</span>
<span><span style="color:#ff4d4d;">❤</span> Health: $health</span>
</div>
<div class="city-grid">
<<link '<span class="nav-card exit-btn">Leave Town</span>' "Map|Region1">><</link>>
<<link '<span class="nav-card">The Workshop</span>' "The Workshop">><</link>>
<<link '<span class="nav-card">Bounty Board</span>' "Bounty Board">><</link>>
<<link '<span class="nav-card">Tavern</span>' "Tavern">><</link>>
<<link '<span class="nav-card">Inn</span>' "Inn">><</link>>
<<link '<span class="nav-card">Market</span>' "Market">><</link>>
<<link '<span class="nav-card">Public Baths</span>' "Public Baths">><</link>>
<<link '<span class="nav-card">Brothel</span>' "Brothel">><</link>>
<<link '<span class="nav-card tournament-btn">⚔ Participate in Tournament ⚔</span>' "TournamentBoard">><</link>>
</div>
<</nobr>>/* Initialize the view if it doesn't exist yet */
<<if $LonePeakView is undefined>><<set $LonePeakView to "monument">><</if>>
<div class="monument-container">
<<if $LonePeakView is "monument">>
<div class="monument-title">The Stone of Recognition</div>
<p>At its center, a stone slab rises from the earth. Carved into its face are the names of those whose insight, effort, or support helped shape the path you now walk.</p>
<div class="monument-names">
Greeedium<br>
telotelo
</div>
<p style="margin-top: 15px;">— and all others whose hands guided the early climb. —</p>
<<else>>
<div class="monument-title">Altar of Divine Laws</div>
<p>Current World Law Alignment: <span style="color:#d4af37;">**v$CurrentGameVersion**</span></p>
<<if $gameVersion eq $CurrentGameVersion>>
<p style="color:#00ff00;"><b>You are aligned with the current world laws. Your cultivation journey is in harmony with the natural order.</b></p>
<<else>>
<p style="color:#ff0000;"><b>Your cultivation is out of sync with the current world laws. Consider realigning to ensure your progress is not hindered. Your World Law Alignment: <span style="color:#d4af37;">**v$gameVersion**</span></b></p><</if>>
<div class="city-grid" style="max-width:320px; border-color: #d4af37; margin: 0 auto;">
<<link '<span class="nav-card" style="color:#00ffff !important;">✨ Align with v0.16</span>' "LonePeak">>
<<set $gameVersion to 0.16>>
<<GameUpdateWidget-016>>
<</link>>
<<link '<span class="nav-card" style="color:#00ffff !important;">✨ Align with v0.17a</span>' "LonePeak">>
<<set $gameVersion to 0.17a>>
<<GameUpdateWidget-017a>>
<</link>>
<<link '<span class="nav-card" style="color:#00ffff !important;">✨ Align with v0.18</span>' "LonePeak">>
<<set $gameVersion to 0.18>>
<<set $CurrentGameVersion to 0.18>>
<<GameUpdateWidget-018>>
<</link>>
</div>
<</if>>
<div class="monument-footer">
The wind is still. The mountain watches in silence...
</div>
</div>
<div class="city-grid" style="max-width: 440px;">
<<if $LonePeakView is "monument">>
/* Update the permanent variable and refresh */
<<link '<span class="nav-card">📜 Approach Altar</span>' "LonePeak">>
<<set $LonePeakView to "update">>
<</link>>
<<else>>
<<link '<span class="nav-card">⬅ Back to Names</span>' "LonePeak">>
<<set $LonePeakView to "monument">>
<</link>>
<</if>>
/* When leaving, reset the view so it's back to 'monument' next time you visit */
<<link '<span class="nav-card exit-btn">⬅ Descend Peak</span>' $passage>>
<<set $LonePeakView to "monument">>
<</link>>
</div><div id="map-container">
<<MapRender>>
</div>
<div id="event-container">
<<RegionEvents>>
<<NpcPosition>>
<<MortalRealm>>
<<TurnsAge>>
<<MissionNotification>>
<<NPCRumours>>
<<MainStorylineWidget>>
<<AfterBattle>>
<<FameUpdater>>
<<WorldRumours>>
<<CheckRevengeEvents>>
</div>
<<set $PlayerLocation to "Region1">>
<<if $peopleVisible is true>>
<<set $peopleVisible = false>>
<</if>><div class="council-hall-container">
<<if $pe eq 0>>
<!-- MAIN RANK PROGRESSION SCREEN -->
<div class="council-header">
<h2>🏯 Council of Elders</h2>
<p class="council-subtitle">The inner sanctum where ranks are recognized and destiny unfolds</p>
</div>
<div class="rank-display">
<div class="rank-badge">
<span class="rank-current">Current Rank</span>
<span class="rank-title"><<print $CurrentPcSectRank>></span>
<span class="sect-name"><<print $CurrentPcAffiliation>></span>
</div>
</div>
<div class="rank-requirements">
<<set _nextRank to "">>
<<set _canPromote to false>>
<<if $CurrentPcSectRank == "Initiate">>
<<set _nextRank to "Disciple">>
<<set _canPromote to $ContributionPoints >= 50 and $CurrentPcSectReputation >= 10 and $sectFavor >= 5>>
<div class="requirement-section">
<h3>Path to Disciplehood</h3>
<p class="requirement-flavor">
The path of a true Disciple requires more than raw power.
You must prove your dedication through service, earn the respect of your peers,
and demonstrate genuine commitment to the sect's values.
</p>
<div class="requirement-list">
<div class="requirement-item <<if $ContributionPoints >= 50>>met<</if>>">
<span class="requirement-icon">⚙️</span>
<span class="requirement-text">Contribution Points: <<print $ContributionPoints>>/50</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($ContributionPoints / 50) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $CurrentPcSectReputation >= 10>>met<</if>>">
<span class="requirement-icon">👥</span>
<span class="requirement-text">Sect Reputation: <<print $CurrentPcSectReputation>>/10</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($CurrentPcSectReputation / 10) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $sectFavor >= 5>>met<</if>>">
<span class="requirement-icon">✦</span>
<span class="requirement-text">Sect Favor: <<print $sectFavor>>/5</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($sectFavor / 5) * 100)>>%"></div>
</div>
</div>
</div>
</div>
<<elseif $CurrentPcSectRank == "Disciple">>
<<set _nextRank to "Inner Disciple">>
<<set _canPromote to $ContributionPoints >= 150 and $CurrentPcSectReputation >= 30 and $sectFavor >= 15>>
<div class="requirement-section">
<h3>The Inner Circle Awaits</h3>
<p class="requirement-flavor">
Inner Disciples stand at the threshold between novice and master.
You must have accumulated significant achievements and proven yourself
worthy of the sect's deeper mysteries and restricted knowledge.
</p>
<div class="requirement-list">
<div class="requirement-item <<if $ContributionPoints >= 150>>met<</if>>">
<span class="requirement-icon">⚙️</span>
<span class="requirement-text">Contribution Points: <<print $ContributionPoints>>/150</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($ContributionPoints / 150) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $CurrentPcSectReputation >= 30>>met<</if>>">
<span class="requirement-icon">👥</span>
<span class="requirement-text">Sect Reputation: <<print $CurrentPcSectReputation>>/30</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($CurrentPcSectReputation / 30) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $sectFavor >= 15>>met<</if>>">
<span class="requirement-icon">✦</span>
<span class="requirement-text">Sect Favor: <<print $sectFavor>>/15</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($sectFavor / 15) * 100)>>%"></div>
</div>
</div>
</div>
</div>
<<elseif $CurrentPcSectRank == "Inner Disciple">>
<<set _nextRank to "Core Disciple">>
<<set _canPromote to $ContributionPoints >= 300 and $CurrentPcSectReputation >= 60 and $sectFavor >= 30>>
<div class="requirement-section">
<h3>The Core of Power</h3>
<p class="requirement-flavor">
Core Disciples are rare individuals chosen to lead the sect's future.
Your cultivation must be exceptional, your wisdom proven,
and your loyalty to the sect beyond question.
</p>
<div class="requirement-list">
<div class="requirement-item <<if $ContributionPoints >= 300>>met<</if>>">
<span class="requirement-icon">⚙️</span>
<span class="requirement-text">Contribution Points: <<print $ContributionPoints>>/300</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($ContributionPoints / 300) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $CurrentPcSectReputation >= 60>>met<</if>>">
<span class="requirement-icon">👥</span>
<span class="requirement-text">Sect Reputation: <<print $CurrentPcSectReputation>>/60</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($CurrentPcSectReputation / 60) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $sectFavor >= 30>>met<</if>>">
<span class="requirement-icon">✦</span>
<span class="requirement-text">Sect Favor: <<print $sectFavor>>/30</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($sectFavor / 30) * 100)>>%"></div>
</div>
</div>
</div>
</div>
<<elseif $CurrentPcSectRank == "Core Disciple">>
<<set _nextRank to "True Disciple">>
<<set _canPromote to $ContributionPoints >= 600 and $CurrentPcSectReputation >= 100 and $sectFavor >= 50>>
<div class="requirement-section">
<h3>Ascension to True Disciplehood</h3>
<p class="requirement-flavor">
True Disciples are legendary figures, standing at the precipice of immortality.
Few ever reach this height. Those who do are destined for greatness—or ruin.
</p>
<div class="requirement-list">
<div class="requirement-item <<if $ContributionPoints >= 600>>met<</if>>">
<span class="requirement-icon">⚙️</span>
<span class="requirement-text">Contribution Points: <<print $ContributionPoints>>/600</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($ContributionPoints / 600) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $CurrentPcSectReputation >= 100>>met<</if>>">
<span class="requirement-icon">👥</span>
<span class="requirement-text">Sect Reputation: <<print $CurrentPcSectReputation>>/100</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($CurrentPcSectReputation / 100) * 100)>>%"></div>
</div>
</div>
<div class="requirement-item <<if $sectFavor >= 50>>met<</if>>">
<span class="requirement-icon">✦</span>
<span class="requirement-text">Sect Favor: <<print $sectFavor>>/50</span>
<div class="requirement-bar">
<div class="requirement-fill" style="width: <<print Math.min(100, ($sectFavor / 50) * 100)>>%"></div>
</div>
</div>
</div>
</div>
<</if>>
</div>
<<if _canPromote>>
<div class="promotion-action">
<<link "🌟 ASCEND TO THE NEXT RANK" "Council Hall|Stage 1">>
<<if $CurrentPcSectRank == "Initiate">>
<<set $pe to 1>>
<<set $CurrentPcSectRank to "Disciple">>
<<set $promotionRank to "Disciple">>
<<elseif $CurrentPcSectRank == "Disciple">>
<<set $pe to 2>>
<<set $CurrentPcSectRank to "Inner Disciple">>
<<set $promotionRank to "Inner Disciple">>
<<elseif $CurrentPcSectRank == "Inner Disciple">>
<<set $pe to 3>>
<<set $CurrentPcSectRank to "Core Disciple">>
<<set $promotionRank to "Core Disciple">>
<<elseif $CurrentPcSectRank == "Core Disciple">>
<<set $pe to 4>>
<<set $CurrentPcSectRank to "True Disciple">>
<<set $promotionRank to "True Disciple">>
<</if>>
<</link>>
</div>
<<else>>
<div class="promotion-blocked">
<p>You must meet all requirements to advance.</p>
</div>
<</if>>
<div class="council-footer">
<<link "⬅️ Return to Sect" $passage>><</link>>
</div>
<!-- ═══════════════════════════════════════════════════════════════ -->
<!-- DISCIPLE PROMOTION CEREMONY -->
<!-- ═══════════════════════════════════════════════════════════════ -->
<<elseif $pe eq 1>>
<div class="ceremony-container">
<div class="ceremony-header">
<h2>🌙 The Rite of Ascension</h2>
</div>
<div class="ceremony-scene">
<p>
The Elder Council chamber falls silent as you step forward. The air itself seems to hold its breath.
</p>
<p>
The Sect Master rises, ancient and commanding. Qi swirls around her form like dragons of light.
"Initiate," she declares, her voice resonating through your very soul,
"you have proven yourself worthy. From this moment, you are recognized as a <b>Disciple</b>
of <<print $CurrentPcAffiliation>>."
</p>
<p>
The other Elders bow their heads in acknowledgment. A warm surge of qi flows through your body,
and you feel the sect's recognition settling into your bones.
</p>
<p>
<i>"To reward your dedication, the sect offers you a gift to aid your continued cultivation."</i>
</p>
</div>
<div class="gift-selection">
<h3>Choose Your Gift:</h3>
<div class="gift-options">
<div class="gift-card">
<h4>💊 Refining Pill</h4>
<p>A potent alchemical creation that accelerates your cultivation progress.</p>
<<link "Select" "Council Hall|Stage 1">>
<<set $pe to 0>>
<<set $discipleGiftReceived to "pill">>
<<set $exp += 500>>
<</link>>
</div>
<div class="gift-card">
<h4>🌫️ Qi Gathering Incense</h4>
<p>Rare incense that enhances your next meditation session significantly.</p>
<<link "Select" "Council Hall|Stage 1">>
<<set $pe to 0>>
<<set $discipleGiftReceived to "incense">>
<<set $insight += 50>>
<</link>>
</div>
<div class="gift-card">
<h4>💰 Spirit Stones</h4>
<p>2,500 Spirit Stones to use as you see fit in the sect's markets.</p>
<<link "Select" "Council Hall|Stage 1">>
<<set $pe to 0>>
<<set $discipleGiftReceived to "stones">>
<<set $gold += 2500>>
<</link>>
</div>
</div>
</div>
</div>
<!-- ═══════════════════════════════════════════════════════════════ -->
<!-- INNER DISCIPLE PROMOTION - MENTOR SELECTION -->
<!-- ═══════════════════════════════════════════════════════════════ -->
<<elseif $pe eq 2>>
<div class="ceremony-container">
<div class="ceremony-header">
<h2>🐉 The Inner Circle</h2>
</div>
<div class="ceremony-scene">
<p>
You stand before the Sect Master once more. This time, the chamber fills with golden light.
</p>
<p>
"Inner Disciple," the Sect Master speaks, her gaze piercing your soul,
"you have ascended beyond the common ranks. To guide you through the mysteries ahead,
you must choose a personal mentor from among our most accomplished Elders."
</p>
<p>
"This bond will shape your future. Choose wisely. Some mentors are stern taskmasters.
Others offer... more intimate forms of guidance."
</p>
<p>
Three Elders step forward, their power evident in the way the air warps around them.
</p>
</div>
<div class="mentor-selection">
<h3>Select Your Mentor:</h3>
<<if !$mentorGenerated>>
<!-- INITIALIZE MENTOR ARRAY -->
<<set $mentor = []>>
<!-- GENERATE THREE MENTORS -->
<<for _i to 0; _i < 4; _i++>>
<<CreateMentor>>
<<set $mentor[_i] = clone(_npc)>>
<<if $CurrentPcSect eq "righteous">>
<<set $mentor[_i].sectNPC to "Clear Sky Azure Dragon Pavilion">>
<<else>>
<<set $mentor[_i].sectNPC to "Ghost King Netherworld Sect">>
<</if>>
<</for>>
<<set $mentorGenerated to true>>
<</if>>
<div class="mentor-cards">
<<for _i to 0; _i < 4; _i++>>
<<if $mentor[_i]>>
<div class="mentor-card">
<div class="mentor-header">
<h4><<print $mentor[_i].fullname>></h4>
<p class="mentor-cultivation"><<print $mentor[_i].realm>></p>
</div>
<div class="mentor-details">
<p><span class="detail-label">Age:</span> <<print $mentor[_i].NPClifespan>></p>
<p><span class="detail-label">Sect:</span> <<print $mentor[_i].sectNPC>></p>
<p><span class="detail-label">Internal Trait:</span> <<print $mentor[_i].internalTrait>></p>
<p><span class="detail-label">External Trait:</span> <<print $mentor[_i].externalTrait>></p>
</div>
<div class="mentor-action">
<<capture _i>>
<<link "Choose as Mentor" "Council Hall|Stage 1">>
<!-- SET MENTOR RELATIONSHIPS -->
<<set $currentNPC to clone($mentor[_i])>>
<!-- ADD MENTOR TO NPC SYSTEM -->
<<AddNPCWithFamily $currentNPC>>
<!-- SET MENTOR AS CHOSEN -->
<<set $plot1Mentor to clone($currentNPC)>>
<<set $mentorChosen to true>>
<<set $pe to 100>>
<</link>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 100>>
Your new mentor, <<print $plot1Mentor.fullname>>, greets you with open arms.
<!-- Player adds mentor to their masters -->
<<set $playerRelations.masters.push($plot1Mentor.id)>>
<!-- Mentor adds player to their apprentices -->
<<set $plot1Mentor.relations.apprentices.push("player")>>
<<link "Continue" "Council Hall|Stage 1">><<set $pe to 0>><</link>>
<!-- ═══════════════════════════════════════════════════════════════ -->
<!-- CORE DISCIPLE PROMOTION -->
<!-- ═══════════════════════════════════════════════════════════════ -->
<<elseif $pe eq 3>>
<div class="ceremony-container">
<div class="ceremony-header">
<h2>⚡ Core Disciple Ascension</h2>
</div>
<div class="ceremony-scene">
<p>
The entire sect seems to tremble as you enter the inner sanctum.
All the Elders are present, seated in a perfect circle, their combined power
creating a palpable pressure in the air.
</p>
<p>
The Sect Master's eyes glow with ancient light. "You have reached a pinnacle few ever attain.
As a <b>Core Disciple</b>, you are now guardian of the sect's deepest secrets."
</p>
<p>
"Your mentor, <<print $plot1Mentor.fullname>>, has vouched for your readiness.
From this day forward, you hold authority over all disciples below your rank."
</p>
<p>
Power surges through you, settling into your meridians like a second heartbeat.
You can feel new cultivation techniques unlocking in your mind—knowledge that was forbidden before.
</p>
<p>
One of the Elders smiles enigmatically. "Come find us, when you wish to discuss...
<i>advanced studies</i>."
</p>
</div>
<div class="ceremony-rewards">
<h3>New Abilities Unlocked:</h3>
<div class="rewards-list">
<div class="reward-item">
<span class="reward-icon">👥</span>
<span class="reward-text">Authority over Junior Disciples</span>
</div>
<div class="reward-item">
<span class="reward-icon">📖</span>
<span class="reward-text">Access to Restricted Techniques</span>
</div>
<div class="reward-item">
<span class="reward-icon">🏛️</span>
<span class="reward-text">Private Training Chamber Available</span>
</div>
<div class="reward-item">
<span class="reward-icon">💕</span>
<span class="reward-text">Mentor Relationship Options Expanded</span>
</div>
</div>
</div>
<div class="ceremony-action">
<<link "Accept Your New Status" "Council Hall|Stage 1">>
<<set $pe to 0>>
<<set $coreDiscipleCeremony to true>>
<<set $maxAuthorityRank to "Disciple">>
<</link>>
</div>
</div>
<!-- ═══════════════════════════════════════════════════════════════ -->
<!-- TRUE DISCIPLE - APOTHEOSIS -->
<!-- ═══════════════════════════════════════════════════════════════ -->
<<elseif $pe eq 4>>
<div class="ceremony-container">
<div class="ceremony-header">
<h2>✨ Ascension to Legend</h2>
</div>
<div class="ceremony-scene">
<p>
The sky itself splits open with cultivated energy as you enter the Sacred Peak.
Every Elder, every Core Disciple, every master of the sect has gathered for this moment.
</p>
<p>
The Sect Master stands alone at the summit, silhouetted against a cascade of falling starlight.
</p>
<p>
"How rare," she whispers, and her voice carries to every corner of the sect.
"Another True Disciple. The heavens acknowledge your ascension."
</p>
<p>
The tribulation begins. Lightning tears across the sky, not to destroy you, but to acknowledge you.
Your body is remade, your soul refined. When the storm clears, you are no longer merely a disciple.
</p>
<p>
You are a <b>legend</b>.
</p>
<p>
The Sect Master approaches and places her palm against your forehead.
Ancient knowledge floods into you—the true history of the sect, secrets of immortality,
and knowledge of powers beyond mortal ken.
</p>
<p style="margin-top: 20px; font-style: italic; text-align: center;">
"Welcome, True Disciple. The future of the sect rests in your hands now."
</p>
</div>
<div class="ceremony-rewards">
<h3>You Have Become:</h3>
<div class="legend-status">
<p>✦ A master of cultivation beyond mortal understanding</p>
<p>✦ A political power in the sect's hierarchy</p>
<p>✦ A potential future Sect Master</p>
<p>✦ A figure of desire and power for many...</p>
</div>
</div>
<div class="ceremony-action">
<<link "Begin Your Legend" "Council Hall|Stage 1">>
<<set $pe to 0>>
<<set $trueDiscipleAchieved to true>>
<</link>>
</div>
</div>
<</if>>
</div><img src="images/Locations/Housing0.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
It's a modest room, but it's yours. Small window lets in the soft light of dawn, casting a warm glow on the wooden floor. A simple bed, small table and simple wardrobe are most of the furnishings. You can hear the distant sounds of the sect grounds waking up - birds chirping, footsteps on stone paths, and the faint murmur of early morning conversations.
<p class="flavor-text">This is your new home within the $CurrentPcAffiliation. It's humble, but it's a place to rest and grow as you embark on your cultivation journey.</p>
<div class="city-grid">
<br><<link '<span class="nav-card exit-btn">Leave</span>' $passage>><</link>>
<br><<link '<span class="nav-card">Stash items</span>' "Stash">><</link>>
<<link '<span class="nav-card">Rest & Sleep</span>' "Housing Rest">><</link>>
<<link '<span class="nav-card">Bathe & Groom</span>' "Housing Bathe">><</link>>
<<link '<span class="nav-card">Pleasure yourself</span>' "Pleasure yourself|Housing">><</link>>
</div><img src="images/Character/Bathing0.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<h2>Rest & Recovery</h2>
<p>The day's rigors have worn you down. You change into comfortable sleeping robes and slide beneath your simple blankets. As your head touches the pillow, a wave of exhaustion washes over you.</p>
<p>Sleep claims you swiftly and deeply. Your dreams are filled with visions of spiritual cultivation—endless gardens of heavenly herbs, ancient temples suspended in clouds, and the flowing currents of cosmic qi surrounding you in an embrace of power and serenity.</p>
<p>When you awaken, the sun has moved across the sky. You feel refreshed, renewed, ready to face whatever challenges await.</p>
<p>✦ A new day awaits your return to the sect grounds.</p>
<<link "Continue to Sect Grounds" $passage>><</link>><h2>Bathe & Groom</h2>
<img src="images/Character/Awake0.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<p>You step into the small bathing area attached to your quarters. The warm water soothes your muscles and washes away the grime of the day. As you bathe, you take a moment to reflect on your journey so far and the path ahead.</p>
<p>After drying off, you groom yourself with care, ensuring you're presentable for interactions within the sect. A clean appearance can make a good impression on your fellow disciples and superiors.</p>
<p>✦ A new day awaits your return to the sect grounds.</p>
<<link "Continue to Sect Grounds" $passage>><</link>><h2>Intimate Moments</h2>
<p>You slip the latch on your door and draw the thin curtain across the small window. The morning light softens to a warm amber haze. In the quiet of your quarters, with the distant sounds of the sect drifting away, you allow yourself this — a moment entirely your own.</p>
<p>You consider what you have available...</p>
<div class="pleasure-options">
<<link "Use your hands — the simplest pleasure">>
<<goto "MasturbationScene_NoToy">>
<</link>><br><br>
<<if $playeriteminventory.some(i => i.id === "jadeprobe")>>
<<link "Retrieve the Jade Probe from your stash">>
<<goto "MasturbationScene_JadeProbe">>
<</link>><br><br>
<</if>>
<<if $playeriteminventory.some(i => i.id === "phoenixfeatherplug")>>
<<link "Take out the Phoenix Feather Plug">>
<<goto "MasturbationScene_PhoenixPlug">>
<</link>><br><br>
<</if>>
<<if $playeriteminventory.some(i => i.id === "lotusbeads")>>
<<link "Unwrap the Lotus Bead String">>
<<goto "MasturbationScene_LotusBeads">>
<</link>><br><br>
<</if>>
<<link "Perhaps another time...">>
<<goto "Housing">>
<</link>>
</div><h2>Simplest Pleasure</h2>
<p>You sink onto the edge of your bed, the worn blanket soft beneath you. No tools, no aids — only your own hands and the quiet permission you give yourself.</p>
<p>You lie back slowly, staring up at the ceiling's rough wooden beams, and let your breathing deepen. One hand slides beneath the loose fabric of your inner robe, tracing the curve of your stomach, the warmth of your own skin unfamiliar yet intimate in a way that makes something loosen in your chest.</p>
<p>Your fingers drift lower. You part your thighs and close your eyes.</p>
<p>It begins slowly — gentle, exploratory — the pad of your fingers circling, finding the places that make your breath catch. You move without urgency, learning yourself the way a cultivator learns a new technique: with patience, with attention. Your hips shift. A soft sound escapes your lips before you press them together.</p>
<p>The pleasure builds in unhurried waves. Your fingers find a rhythm and hold it, the warmth spreading upward through your belly, into your chest. Your free hand presses flat against the mattress, grounding you. The distant sounds of the sect feel very far away now.</p>
<p>When the peak finally breaks over you, it is quiet and complete — a soft shudder, a held breath released, your body going still and then loose. You lie there for a long moment afterward, one arm thrown over your eyes, your heart slowing.</p>
<p><em>Simple,</em> you think. <em>But enough.</em></p>
<p>You rise, straighten your robes, and smooth your hair. The morning waits.</p>
<<set $energy += 5>>
[[Return to your room.|Housing]]<h2>The Jade Probe</h2>
<p>You reach into your stash and close your fingers around the Jade Probe. Even before you unwrap it fully, you can feel the faint warmth emanating from within the smooth stone.</p>
<p>You take it to your bed.</p>
<p>Lying back, you hold the probe above you for a moment. The jade is flawless - a deep, misted green, carved with subtle ridges along its length that follow the lines of theoretical meridian maps you half-remember from your introductory cultivation texts. Whoever made this understood anatomy in ways that went beyond medicine.</p>
<p>You touch the tip to your inner thigh first. The jade has warmed to match your skin and the contact draws a slow exhale from you.</p>
<p>You take your time preparing yourself, your own fingers working first until your breathing has deepened and your body is ready. Then you guide the probe carefully into place.</p>
<p>The sensation is immediate and layered — the fullness of it, the smooth pressure against your inner walls, and beneath that, the unmistakable tingle of qi beginning to move. Subtle at first, barely distinguishable from ordinary arousal, but as you begin to move the probe in slow, deliberate strokes, it builds into something with a character all its own. </p>
<p>Your hips roll instinctively. Your free hand presses over your lower abdomen as if trying to hold the sensation in place.</p>
<p>You work yourself slowly toward the edge, the jade's internal rhythm syncing with your breathing until the two are indistinguishable. When the release comes it arrives with unusual depth — not just physical but something beneath it, your core meridians flushing with warmth that lingers long after your body has stilled.</p>
<p>You lie with the probe resting against your stomach, breathing, feeling the residual qi settle.</p>
<p><em>Yin essence refinement,</em> the pamphlet tucked inside its wrapping had called it. You had thought it euphemism. You are no longer certain.</em></p>
<<set $energy += 10>>
<<set $corruption += 1>>
[[Return to your room.|Housing]]<h2>The Phoenix Feather Plug</h2>
<p>You unwrap the Phoenix Feather Plug from its silk cloth with the careful hands of someone handling something that embarrasses and fascinates them in equal measure.</p>
<p>The jade tapers to a narrow tip that widens into a smooth, full body before narrowing again at the base — a delicate, precise thing. The phoenix feather tail fans out at the end, rust-red and gold, impossibly soft when you brush it against your wrist. It looks almost decorative. It is not.</p>
<p>You prepare yourself at the edge of your bed, kneeling forward over your folded arms, breathing deliberately slow.</p>
<p>You work the plug in gradually — carefully, patiently — the smooth jade offering little resistance once you have relaxed enough to accept it. The fullness that settles there when it seats itself completely is dense and insistent, a pressure in a place you are not accustomed to being aware of. Your breath stutters. You hold still for a long moment, adjusting.</p>
<p>Then the plug warms.</p>
<p>It begins as a gentle heat, the yang fire the plug's description promised — a slow burn that radiates outward from where it sits nestled inside you, moving in pulses along the rear meridian pathways. You press your face into your folded arms and make a sound that you are grateful no one is here to hear.</p>
<p>You lower yourself carefully to lie face-down on the bed, the feather tail splayed against the small of your back, and let your hand work between your thighs. The combination is overwhelming in a way that is almost too much and precisely enough — the external pleasure and the deep interior warmth moving through you simultaneously, each amplifying the other.</p>
<p>The climax, when it comes, makes you grip the mattress and press your teeth together. It rolls through you in waves, the yang energy dissipating outward from your core in a slow, flushing heat that leaves you limp and vaguely astonished.</p>
<p>You roll onto your side carefully, the plug still in place, and stare at the wall for a while, thinking of nothing in particular.</p>
<p><em>Forbidden pleasure cultivation,</em> you think. <em>Yes. That is exactly what that was.</em></p>
<<set $energy += 10>>
<<set $corruption += 1>>
[[Return to your room.|Housing]]<h2>The Lotus Bead String</h2>
<p>You lift the Lotus Bead String from its pouch and let it pool in your palm. Rose quartz, graduated from small to large — nine beads, each one smooth and faintly translucent, strung on a cord of braided silk. They catch the morning light and scatter it in soft pink constellations across your skin.</p>
<p>Even before use they carry a faint vibration — a resonance you feel more than hear, a hum at the very edge of perception. Yin qi, concentrated and refined.</p>
<p>You take your time.</p>
<p>Lying back on your bed, you spend several long minutes simply breathing, letting your body relax fully — your cultivator's discipline turned inward, toward softness rather than rigor. Then you begin.</p>
<p>You choose vaginal insertion first. The smallest bead slides home easily and the vibration it emits inside you is immediate and startling — a focused, resonant pulse that seems to speak directly to something deep in your meridians. You add the next bead. Then the next. Each one broader than the last, each one contributing its own frequency to the growing chorus within you until you are stretched full and trembling faintly, your inner walls clenching around the string involuntarily.</p>
<p>You reach the point where you can take no more and simply lie there for a moment, breathing through your mouth, the beads humming their collective song inside you while your fingers work slow circles at the apex of your thighs.</p>
<p>When you pull the string, you do it slowly — one bead at a time — and each withdrawal sends a distinct pulse of yin qi flooding outward through your meridians like a struck string resonating. You cry out softly on the fourth bead and bite down on your knuckle by the sixth.</p>
<p>The final bead pulls free and the release that crashes through you is unlike any simple physical pleasure — it is as though every meridian in your lower body fires at once, a full-body resonance that leaves you flat and breathless and oddly, profoundly calm in its aftermath.</p>
<p>You clean the beads carefully with the cloth from the pouch and rewrap them, your hands still faintly unsteady.</p>
<p><em>Extended masturbation sessions and meridian stretching,</em> the inscription on the pouch read. <em>You are beginning to understand that description as technically precise.</em></p>
<<set $energy += 12>>
<<set $corruption += 3>>
[[Return to your room.|Housing]]\
\
<<set _currentRankIndex = $sectRanks.indexOf($CurrentPcSectRank)>>\
<<if $selectedFloor eq null>>\
<<set $selectedFloor = "Initiate">>\
<</if>>\
<div class="floor-selector" style="margin-bottom: 1em;">\
<<link "Go back" $passage>><<set $pe to 0>> <</link>>\
<<if _currentRankIndex gte $sectRanks.indexOf("Initiate")>>
<<link "📘 Floor I" "Manual Library|Stage 1">><<set $selectedFloor = "Initiate">><</link>>\
<</if>>\
<<if _currentRankIndex gte $sectRanks.indexOf("Disciple")>>
<<link "📙 Floor II" "Manual Library|Stage 1">><<set $selectedFloor = "Disciple">><</link>>\
<</if>>\
</div>\
\
<<set _floorRank = $selectedFloor>>\
<<set _floorIndex = $sectRanks.indexOf(_floorRank)>>\
<<set _floorLabel = _floorRank.toUpperCase()>>\
<<if _currentRankIndex >= _floorIndex>>\
\
\
\
<h2 class="floor-header">📜 Manual Library – <<= _floorLabel >></h2>\
<<set _manualList = $sectManuals[$CurrentPcSect][_floorRank]>>\
\
<<if _manualList and _manualList.length > 0>>\
<<for _manual range _manualList>>\
<<capture _manual>>\
<div class="manual-entry" style="border:1px solid #444; border-radius:8px; padding:0.75em; margin-bottom:1em; background:#1a1a1a; color:#e0e0e0;">
<h4 style="margin:0 0 0.2em 0;">\
<<= _manual.name >> \
<span style="font-size: 0.8em; font-weight: normal; color:#aaa;">[<i><<= _manual.category >> Manual</i>]</span>\
</h4>\
<p style="margin:0 0 0.5em 0;"><small><<= _manual.description >></small></p>\
<p style="margin:0 0 0.5em 0;">🪙 <b>Cost:</b> <span style="color:#ffe28a;"><<= _manual.ContributionPointCost >> CP</span></p>\
\
<<set _alreadyKnown = $skillInventory.some(x => x.skillid == _manual.skillid)>>\
\
<<if _alreadyKnown>>\
<div class="manual-note" style="color:#6cff6c;">✔️ You already possess this manual.</div>\
<<else>>\
<<if $ContributionPoints >= _manual.ContributionPointCost>>\
<<link "Learn this Manual" "Manual Library|Stage 1">>\
<<set $ContributionPoints -= _manual.ContributionPointCost>>\
<<set $skillInventory.push(clone(_manual))>>\
You’ve successfully acquired the <<=_manual.name>> manual!
<<replace "#manuals">><<include "ManualLibrary">>\<</replace>>\
<</link>>\
<<else>>\
<div class="manual-note" style="color:#ff6666;">❌ Not enough Contribution Points.</div>\
<</if>>\
<</if>>\
</div>\
<</capture>>\
<</for>>\
\
<<else>>\
<p style="color:#aaa;">📭 No manuals available on this floor.</p>
<</if>>\
\
<<else>>\
<p style="color:#999;">🚫 You do not have permission to access this floor.</p>
<</if>>\
\
<div id="manuals"></div>\<<set _currentRankIndex = $sectRanks.indexOf($CurrentPcSectRank)>>
<<if !$SectSideMissions or $SectSideMissions.length == 0>>
<<refreshMissions>>
<</if>>
<<set _availableMissions = $SectSideMissions
.filter(m => {
if (!m.requiredRank) {
return true;
}
return $sectRanks.indexOf(m.requiredRank) <= _currentRankIndex;
})
.shuffle()
.slice(0, 3)
>>
<div class="sect-mission-container">
<div class="mission-header">
<h2>Mission Hall</h2>
<p class="mission-subtitle">Undertake tasks for sect advancement</p>
</div>
<div class="missions-list">
<<for _mission range _availableMissions>>
<div class="mission-entry sect-mission">
<div class="mission-top">
<div class="mission-info">
<p class="mission-name"><<print _mission.name>></p>
<p class="mission-description"><<print _mission.description>></p>
<!-- KNOWN COMBAT: Show enemy realm -->
<<if _mission.isCombat eq true and _mission.enemyRealm>>
<div class="mission-enemy-info">
<span class="enemy-label">Expected Enemy:</span>
<span class="enemy-realm"><<print _mission.enemyStage>> <<print _mission.enemyRealm>></span>
</div>
<!-- UNKNOWN COMBAT: Show ??? -->
<<elseif _mission.isCombat eq "unknown">>
<div class="mission-enemy-info">
<span class="enemy-label">Possible Threat:</span>
<span class="enemy-unknown">??? Unknown ???</span>
</div>
<</if>>
<!-- TWIST EVENT -->
<<if _mission.twistEvent>>
<div class="mission-twist-note">
<span class="twist-label">⚠ Special Event</span>
</div>
<</if>>
</div>
<div class="mission-reward">
<span class="reward-value"><<print _mission.reward>></span>
<span class="reward-label">contribution</span>
<<if _mission.favor>>
<span class="reward-value" style="font-size: 0.9em; margin-top: 4px;">+<<print _mission.favor>></span>
<span class="reward-label">favor</span>
<</if>>
</div>
</div>
<div class="mission-actions">
<<if $SideMissionStatus is null>>
<<capture _mission>>
<<link "Accept Mission" "Mission Hall|Stage 1">>
<<set $activeSideMission to _mission>>
<<set $SideMissionStatus to "accepted">>
<<set $MissionType to "sect">>
<<set $activeSideMission.missionCordX to $playerX>>
<<set $activeSideMission.missionCordY to $playerY>>
<<replace "#missionlog">><div class="mission-accepted">✓ Accepted: <<= _mission.name>></div><</replace>>
<</link>>
<</capture>>
<</if>>
</div>
</div>
<</for>>
</div>
<div id="missionlog"></div>
<<if $activeSideMission neq null>>
<div class="active-mission-panel">
<h3>Current Mission</h3>
<p><strong><<print $activeSideMission.name>></strong></p>
<p class="mission-description"><<print $activeSideMission.description>></p>
<!-- KNOWN COMBAT: Show expected enemy -->
<<if $activeSideMission.isCombat eq true and $activeSideMission.enemyRealm>>
<div class="enemy-info">
<span class="enemy-label">Expected Enemy:</span>
<span class="enemy-realm"><<print $activeSideMission.enemyStage>> <<print $activeSideMission.enemyRealm>></span>
</div>
<!-- UNKNOWN COMBAT: Show unknown status -->
<<elseif $activeSideMission.isCombat eq "unknown">>
<div class="enemy-info">
<span class="enemy-label">Possible Threat:</span>
<span class="enemy-unknown">??? Unknown ???</span>
</div>
<</if>>
<div class="reward-info">
Reward: <<print $activeSideMission.reward>> contribution points
<<if $activeSideMission.favor>>
+ <<print $activeSideMission.favor>> sect favor
<</if>>
</div>
<div class="mission-controls">
<<if $activeSideMission.missionCordX eq $playerX and $activeSideMission.missionCordY eq $playerY>>
<<link "You're on mission location! Start mission" "Mission|Region1">><</link>>
<</if>>
<<link "Abandon Mission" "Mission Hall|Stage 1">>
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<<replace "#missionlog">><div class="mission-abandoned">✗ Mission abandoned</div><</replace>>
<</link>>
</div>
</div>
<</if>>
<div class="mission-controls-bottom">
<<link "⟳ Refresh Missions" "Mission Hall|Stage 1">>
<<refreshMissions>>
<</link>>
<<link "Leave Hall" $passage>><</link>>
</div>
</div><<if $pe eq 0>>
<div class="spirit-pavilion">
<h3>🌌 Spirit Pavilion</h3>
<p>You may rent a chamber here and meditate in peace. The cost is <b>3 Contribution Points</b> for <b>1 EXP</b>.</p>
<p><b>You currently have:</b> <span style="color:#ffe28a;"><<= $ContributionPoints >> Contribution Points</span></p>
<label for="spiritInput">How many Contribution Points do you wish to spend?</label><br>
<<textbox "$spiritpavilion" $spiritpavilion size 5>>
<div style="text-align: center;" class="action-btn">
<<link "Meditate">>
<<set $spiritpavilion = parseInt($spiritpavilion)>>
<<if isNaN($spiritpavilion) or $spiritpavilion <= 0>>
<<replace "#meditationResult">><div id="meditationResult" style="color: #ff6666;">⚠️ Please enter a valid number greater than 0.</div><</replace>>
<<elseif $ContributionPoints < $spiritpavilion>>
<<replace "#meditationResult">><div id="meditationResult" style="color: #ff6666;">❌ You do not have enoughContribution Points.</div><</replace>>
<<else>>
<<set _expGained = Math.floor($spiritpavilion / 3)>>
<<set $ContributionPoints -= $spiritpavilion>>\
<<set $exp += _expGained>>\
<<set $pe = 1>>\
<<replace "#meditationResult">>
<div id="meditationResult" style="color: #6cff6c;">✅ You meditated successfully and gained <b><<= _expGained >> EXP</b>.</div>
<</replace>>\
<</if>>\
<</link>>\
<br><<link "Leave" $passage>><<set $pe = 0>><</link>>
</div>
<div id="meditationResult" style="margin-top:1em;"></div>
</div>\
\
\
<</if>><div class="stash-management-container">
<div class="stash-header">
<h1>Sacred Spatial Repository</h1>
<p>Exchange treasures between your stash and personal inventory with divine ease.</p>
</div>
<<if $playerstashinventory eq null>><<set $playerstashinventory to []>><</if>>
<div class="dual-inventory-layout">
<!-- LEFT COLUMN: STASH -->
<div class="inventory-column stash-column">
<div class="column-header stash-header-title">
<h2>Spatial Stash</h2>
<p>Your hidden pocket of space</p>
</div>
<!-- STASH ITEMS -->
<div class="inventory-section">
<h3 class="section-title">Treasured Items</h3>
<<if $playerstashinventory.filter(item => item.type === "item" || item.type === undefined).length gt 0>>
<table class="transfer-inventory-table">
<thead>
<tr>
<th style="width: 60px;"></th>
<th>Item</th>
<th style="width: 80px; text-align: center;">Qty</th>
<th style="width: 100px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _item range $playerstashinventory>>
<<if _item.type === "item" || _item.type === undefined>>
<<if _item.quantity gt 0>>
<tr class="transfer-row">
<td style="text-align: center;">
<div class="item-icon">宝</div>
</td>
<td>
<<hovertip _item.description>>
<div class="item-name"><<print _item.name>></div>
<</hovertip>>
</td>
<td style="text-align: center;">
<div class="quantity-display"><<print _item.quantity>></div>
</td>
<td style="text-align: center;">
<<capture _item>>
<<link "→" `passage()`>>
<<if _item.quantity gt 0>>
<<set _item.quantity -= 1>>
<<if $playeriteminventory.some(i => i.name === _item.name)>>
<<set $playeriteminventory.find(i => i.name === _item.name).quantity += 1>>
<<else>>
<<set $playeriteminventory.push(clone(_item))>>
<<set $playeriteminventory[$playeriteminventory.length - 1].quantity to 1>>
<</if>>
<<if _item.quantity <= 0>>
<<set $playerstashinventory.deleteAt($playerstashinventory.indexOf(_item))>>
<</if>>
<</if>>
<</link>>
<</capture>>
</td>
</tr>
<</if>>
<</if>>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-container">
<p>No items stored.</p>
<p>Transfer treasures from your inventory here.</p>
</div>
<</if>>
</div>
<!-- STASH POTIONS -->
<div class="inventory-section">
<h3 class="section-title">Elixirs & Potions</h3>
<<if $playerstashinventory.filter(item => item.type === "potion").length gt 0>>
<table class="transfer-elixir-table">
<thead>
<tr>
<th style="width: 60px;"></th>
<th>Elixir</th>
<th style="width: 70px; text-align: center;">Grade</th>
<th style="width: 60px; text-align: center;">Qty</th>
<th style="width: 100px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _potion range $playerstashinventory>>
<<if _potion.type === "potion">>
<<if _potion.quantity gt 0>>
<<set _rarityColor to
(_potion.grade <= 1 ? "#4fc3f7" :
_potion.grade <= 3 ? "#66bb6a" :
_potion.grade <= 5 ? "#ffa726" :
"#ab47bc")>>
<tr class="transfer-row">
<td style="text-align: center;">
<div class="elixir-icon">丹</div>
</td>
<td>
<<hovertip _potion.description>>
<div class="item-name" style="color: <<print _rarityColor>>;"><<print _potion.name>></div>
<</hovertip>>
</td>
<td style="text-align: center; color: <<print _rarityColor>>; font-weight: bold;">
<<print _potion.grade>>
</td>
<td style="text-align: center;">
<div class="quantity-display"><<print _potion.quantity>></div>
</td>
<td style="text-align: center;">
<<capture _potion>>
<<link "→" `passage()`>>
<<if _potion.quantity gt 0>>
<<set _potion.quantity -= 1>>
<<if $playerpotioninventory.some(p => p.name === _potion.name)>>
<<set $playerpotioninventory.find(p => p.name === _potion.name).quantity += 1>>
<<else>>
<<set $playerpotioninventory.push(clone(_potion))>>
<<set $playerpotioninventory[$playerpotioninventory.length - 1].quantity to 1>>
<</if>>
<<if _potion.quantity <= 0>>
<<set $playerstashinventory.deleteAt($playerstashinventory.indexOf(_potion))>>
<</if>>
<</if>>
<</link>>
<</capture>>
</td>
</tr>
<</if>>
<</if>>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-container">
<p>No elixirs stored.</p>
<p>Preserve rare potions in your stash.</p>
</div>
<</if>>
</div>
</div>
<!-- RIGHT COLUMN: INVENTORY -->
<div class="inventory-column inventory-column-active">
<div class="column-header inventory-header-title">
<h2>Personal Inventory</h2>
<p>Items at hand for your journey</p>
</div>
<!-- INVENTORY ITEMS -->
<div class="inventory-section">
<h3 class="section-title">Treasured Items</h3>
<<if $playeriteminventory.filter(item => item.quantity gt 0).length gt 0>>
<table class="transfer-inventory-table">
<thead>
<tr>
<th style="width: 60px;"></th>
<th>Item</th>
<th style="width: 80px; text-align: center;">Qty</th>
<th style="width: 100px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _item range $playeriteminventory>>
<<if _item.quantity gt 0>>
<tr class="transfer-row">
<td style="text-align: center;">
<div class="item-icon">宝</div>
</td>
<td>
<<hovertip _item.description>>
<div class="item-name"><<print _item.name>></div>
<</hovertip>>
</td>
<td style="text-align: center;">
<div class="quantity-display"><<print _item.quantity>></div>
</td>
<td style="text-align: center;">
<<capture _item>>
<<link "←" `passage()`>>
<<if _item.quantity gt 0>>
<<set _item.quantity -= 1>>
<<if $playerstashinventory.some(i => i.name === _item.name)>>
<<set $playerstashinventory.find(i => i.name === _item.name).quantity += 1>>
<<else>>
<<set $playerstashinventory.push(clone(_item))>>
<<set $playerstashinventory[$playerstashinventory.length - 1].quantity to 1>>
<</if>>
<<if _item.quantity <= 0>>
<<set $playeriteminventory.deleteAt($playeriteminventory.indexOf(_item))>>
<</if>>
<</if>>
<</link>>
<</capture>>
</td>
</tr>
<</if>>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-container">
<p>Your hands are empty.</p>
<p>Retrieve items from your stash or collect new treasures.</p>
</div>
<</if>>
</div>
<!-- INVENTORY POTIONS -->
<div class="inventory-section">
<h3 class="section-title">Elixirs & Potions</h3>
<<if $playerpotioninventory.filter(potion => potion.quantity gt 0).length gt 0>>
<table class="transfer-elixir-table">
<thead>
<tr>
<th style="width: 60px;"></th>
<th>Elixir</th>
<th style="width: 70px; text-align: center;">Grade</th>
<th style="width: 60px; text-align: center;">Qty</th>
<th style="width: 100px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _potion range $playerpotioninventory>>
<<if _potion.quantity gt 0>>
<<set _rarityColor to
(_potion.grade <= 1 ? "#4fc3f7" :
_potion.grade <= 3 ? "#66bb6a" :
_potion.grade <= 5 ? "#ffa726" :
"#ab47bc")>>
<tr class="transfer-row">
<td style="text-align: center;">
<div class="elixir-icon">丹</div>
</td>
<td>
<<hovertip _potion.description>>
<div class="item-name" style="color: <<print _rarityColor>>;"><<print _potion.name>></div>
<</hovertip>>
</td>
<td style="text-align: center; color: <<print _rarityColor>>; font-weight: bold;">
<<print _potion.grade>>
</td>
<td style="text-align: center;">
<div class="quantity-display"><<print _potion.quantity>></div>
</td>
<td style="text-align: center;">
<<capture _potion>>
<<link "←" `passage()`>>
<<if _potion.quantity gt 0>>
<<set _potion.quantity -= 1>>
<<if $playerstashinventory.some(p => p.name === _potion.name)>>
<<set $playerstashinventory.find(p => p.name === _potion.name).quantity += 1>>
<<else>>
<<set $playerstashinventory.push(clone(_potion))>>
<<set $playerstashinventory[$playerstashinventory.length - 1].quantity to 1>>
<</if>>
<<if _potion.quantity <= 0>>
<<set $playerpotioninventory.deleteAt($playerpotioninventory.indexOf(_potion))>>
<</if>>
<</if>>
<</link>>
<</capture>>
</td>
</tr>
<</if>>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-container">
<p>No elixirs in hand.</p>
<p>Retrieve potions from your stash when needed.</p>
</div>
<</if>>
</div>
</div>
</div>
<div class="stash-actions">
<<link "Return to Housing" "Housing">><</link>>
</div>
</div>You wandered for a while, but you couldn't found anything interesting!
<<link "Go back" $passage>> <<set $pe to 0>> <</link>><<nobr>>
<<set $origin = passage()>>
<div class="brothel-container">
<div class="location-header" style="text-align:center;">
<img src="images/Locations/Brothel.jpg" class="location-bg" width="60%">
<h2 style="color:#d4af37; text-shadow: 2px 2px 4px #000;">✦ The Crimson Blossom Brothel ✦</h2>
<p style="font-style:italic; color:#b09070;">A sanctuary of earthly delights where incense smoke veils the transaction of spirit stones for fleeting ecstasy.</p>
</div>
<<set _courtesans = []>>
<<for _i = 0; _i lt random(3,4); _i++>>
<<set _gender to ["male","female"].random()>>
<<set _name = (_gender == "male" ? $male_npc_names.random() : $female_npc_names.random())>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _price = random(60, 120)>>
<<set _courtesans.push({
fullname: _fullname,
gender: _gender,
charm: random(30,85),
depravity: random(20,90),
skill: random(30,100),
price: _price
})>>
<</for>>
<div class="brothel-actions">
<h3 style="text-align:center; color:#d4af37;">🏮 Tonight's Attendants 🏮</h3>
<div class="grid-2col">
<<for _c range _courtesans>>
<<capture _c>>
<div class="courtesan-card">
<span class="courtesan-name">_c.fullname</span>
<span class="attr-label">Identity:</span> <span class="${_c.gender}">_c.gender</span><br>
<span class="attr-label">Charm:</span> _c.charm | <span class="attr-label">Depravity:</span> _c.depravity<br>
<div class="price-tag">Price: _c.price Spirit Stones</div>
<div style="margin-top:10px;">
<<if $gold gte _c.price>>
<<link "Enter Private Chamber">>
<<set $gold -= _c.price>>
<<set _courtesanObj = {
fullname: _c.fullname,
gender: _c.gender,
id: "courtesan_" + _i + "_" + Date.now()
}>>
<<set $sexPartner = _courtesanObj>>
<<set $sexType = "brothel_hire">>
<<set $sexReturnPassage = $origin>>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<span style="color:#666; font-size:0.9em;">[Insufficient Spirit Stones]</span>
<</if>>
</div>
</div>
<</capture>>
<</for>>
</div>
<<if $corruption > 50>>
<div class="work-option">
<h3 style="color:#ff69b4;">💃 Sell Your Services</h3>
<p>The Madam looks you up and down, a wicked smile spreading as her eyes appraise your assets. "Oh, you'll do perfectly," she murmurs. "The patrons are going to pay a absolute fortune to wear out a body like yours tonight."</p>
<<link "Work the Night Shift">>
<<set $sexPartner = "the Madam's clients">>
<<set $sexType = "brothel_work">>
<<set $sexReturnPassage = $origin>>
<<goto "EncounterInteractionSex">>
<</link>>
</div>
<</if>>
<div style="text-align:center; margin-top:30px;">
<<link "Return to the City Streets" $city>><</link>>
</div>
</div>
<div id="interaction-result"></div>
</div>
<</nobr>><div class="inn-scene">
<<if $pe eq 0>>
<<setupInn>>
<p>You push open the creaking wooden doors of the inn. A faint scent of herbal incense hangs in the air.</p>
<<if $roomAvailable lt 30>>
<div class="dialogue">
"I'm sorry, but we're fully booked tonight. A merchant caravan arrived just before sunset."
</div>
<<link "Leave the Inn" $passage>><<set $pe to 0>><</link>>
<<else>>
<div class="dialogue">
"Welcome, traveler. A good night's rest will restore your strength."
</div>
<p class="cost-tag">Cost: $innStayCost Spirit Stones</p>
<<if $gold gte $innStayCost>>
<<link "Rent a room and rest" "Inn">>
<<set $pe to 1>>
<</link>>
<<else>>
<p class="warning">"You don't have enough coin," the innkeeper says coldly.</p>
<</if>>
<br>
<<link "Go back" $passage>><<set $pe to 0>><</link>>
<</if>>
<<elseif $pe eq 1>>
<<set _eventRoll to random(1, 100)>>
<p>You sleep soundly through the night. Your body heals and your qi stabilizes.</p>
<<if _eventRoll gte 85>>
/* NSFW Event Trigger */
<p class="dialogue">A sudden, oppressive warmth floods the room. The air grows heavy with a musky scent. You are not alone.</p>
<<link "Open your eyes" InnEvent_NSFW>><</link>>
<<elseif _eventRoll lte 15>>
/* Bad Event: Thievery */
<p class="warning">You wake up to find your coin purse lighter. Someone picked your lock!</p>
<<set $gold -= 10>>
<<link "Wake up" $passage>><<set $pe to 0>><</link>>
<<else>>
/* Standard Rest */
<p>You feel refreshed and restored.</p>
<<restEffect>>
<<link "Wake up" $passage>><<set $pe to 0>><</link>>
<</if>>
<</if>>
</div><<if $pe eq 0>>
<img src="images/Locations/market.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<<link "Go back" $passage>><<set $pe to 0>><</link>>
You enter the bustling market square, where merchants hawk their wares and the air is thick with the scent of exotic spices and herbs. Colorful stalls line the streets, each offering unique items from across the realm.
<<link "Mysterious Pill Forge" "Market">><<set $pe to 1>><</link>>
<<link "Thunderclap Sword Forge" "Market">><<set $pe to 11>><</link>>
<<link "Bliss Furnace Pavilion" "Market">><<set $pe to 21>><</link>>
<<elseif $pe eq 1>>
<<nobr>>
<img src="images/Locations/AzureCauldronPavilion.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<br>You approach the Azure Cauldron Pavilion, where a robed pill refiner tends bubbling cauldrons of spiritual elixirs. The air hums with pure qi and the scent of rare herbs.
<div style="margin:20px 0; padding:15px; background:rgba(30,60,100,0.5); border:2px solid #ffd700; border-radius:10px;">
<br><<link "Go back" $passage>><<set $pe to 0>><</link>>
<br><<link "Browse pills" "Market">><<set $pe to 2>><</link>>
<br><<link "Look for recipes" "Market">><<set $pe to 5>><</link>>
<br><<link "Chat with the alchemist">>
<<set _talk to true>>
<<replace "#chat-output">>The alchemist leans closer with a sly smile and says: <span class="male1">"<<print $azureCauldronChat.random()>>"</span><</replace>><</link>>
<br><span id="chat-output"></span>
</div>
<</nobr>>
<<elseif $pe eq 2>>
<div class="merchant-header">
<h2>The Mysterious Pill Forge</h2>
<p>The air hums with alchemical qi as colorful elixirs glow faintly within jade bottles.</p>
</div>
<<link "Return to Market" "Market">><<set $pe to 0>><</link>>
You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Elixir Offerings</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $mysteriouspillforgeInventory.length; _i++>>
<<set _item to $mysteriouspillforgeInventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough gold</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playerpotioninventory.length; _j++>>
<<if $playerpotioninventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playerpotioninventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playerpotioninventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<elseif $pe eq 5>>
<<nobr>>
/* On first visit, shuffle and pick 4-6 items to display */
<<if !$pillforgDisplayed or $pillforgDisplayed.length is 0>>
<<set _shuffled to $mysteriouspillforgePillRecipeInventory.slice()>>
/* Fisher-Yates shuffle */
<<set _len to _shuffled.length - 1>>
<<for _s to _len; _s gt 0; _s-->>
<<set _r to Math.floor(Math.random() * (_s + 1))>>
<<set _tmp to _shuffled[_s]>>
<<set _shuffled[_s] to _shuffled[_r]>>
<<set _shuffled[_r] to _tmp>>
<</for>>
/* Pick between 4 and 6 items (or fewer if inventory is small) */
<<set _displayCount to Math.min(_shuffled.length, Math.floor(Math.random() * 3) + 4)>>
<<set $pillforgDisplayed to _shuffled.slice(0, _displayCount)>>
<</if>>
<div class="merchant-header">
<h2>The Mysterious Pill Forge</h2>
<p>The air hums with alchemical qi as colorful elixirs glow faintly within jade bottles.</p>
</div>
<<link "Return to Market" "Market">><<set $pe to 0>><<unset $pillforgDisplayed>><</link>>
You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Elixir Recipe Offerings</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $pillforgDisplayed.length; _i++>>
<<set _item to $pillforgDisplayed[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name + " Recipe">></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print _item.merchantCost>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<if _item.merchantCost gt $gold>>
<span class="not-enough">Not enough gold</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $knownRecipes.length; _j++>>
<<if $knownRecipes[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $knownRecipes[_index].quantity += 1>>
<<else>>
<<set _newRecipe to clone(_item)>>
<<set $knownRecipes.push(_newRecipe)>>
<</if>>
<<set $gold -= _item.merchantCost>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
/* Remove from both display list and master inventory */
<<set $pillforgDisplayed.deleteAt(_i)>>
<<set $mysteriouspillforgePillRecipeInventory.delete(_item)>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<</nobr>>
<<elseif $pe eq 11>>
<<nobr>>
<img src="images/Locations/HeavenlyEdgeArmory.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
You approach the Heavenly Edge Armory, where a stern forge master hammers spirit blades to razor perfection. The air crackles with fiery qi and the clash of enchanted steel
<div style="margin:20px 0; padding:15px; background:rgba(30,60,100,0.5); border:2px solid #ffd700; border-radius:10px;">
<br><<link "Go back" $passage>><<set $pe to 0>><</link>>
<br><<link "Chat with the forge master">>
<<set _talk to true>>
<<replace "#chat-output">>The alchemist leans closer with a sly smile and says: <span class="male1">"<<print $thunderClapChat.random()>>"</span><</replace>><</link>>
<br><span id="chat-output"></span>
<br>
<br><<link "Browse weapons" "Market">><<set $pe to 12>><</link>>
</div>
<</nobr>>
<<elseif $pe eq 12>>
<div class="merchant-header">
<h2>Thunderclap Sword Forge</h2>
</div>
<<link "Return to Market" "Market">><<set $pe to 0>><</link>>
You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Weapons Offerings</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $thunderclapswordforgeInventory.length; _i++>>
<<set _item to $thunderclapswordforgeInventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough gold</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $weaponInventory.length; _j++>>
<<if $weaponInventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $weaponInventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $weaponInventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<elseif $pe eq 21>>
<<nobr>>
<img src="images/Locations/BlissFurnacePavilion.webp" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<br>You approach the Bliss Furnace Pavilion, where an eccentric alchemist brews elixirs of passion and desire. The air shimmers with intoxicating fumes and whispers of hidden pleasures.
<div style="margin:20px 0; padding:15px; background:rgba(30,60,100,0.5); border:2px solid #ffd700; border-radius:10px;">
<br><<link "Go back" $passage>><<set $pe to 0>><</link>>
<br><<link "Chat with the alchemist">>
<<set _talk to true>>
<<replace "#chat-output">>The alchemist leans closer with a sly smile and says: <span class="male1">"<<print $blissFurnaceChat.random()>>"</span><</replace>><</link>>
<br><span id="chat-output"></span>
<br>
<br><<link "Browse elixirs" "Market">><<set $pe to 22>><</link>>
<br><<if $gold gte 250>><<link "Yin-Yang Harmony Massage" "Market">><<set $pe to 23>><<set $gold -= 250>><</link>><<else>>Not enough Spirit Stones for Massage <</if>>
<br><<link "Personalized Jade Artifact Fitting" "Market">><<set $pe to 28>><</link>>
</div>
<</nobr>>
<<elseif $pe eq 22>>
<div class="merchant-header">
<h2>Bliss Furnace Pavilion</h2>
</div>
<<nobr>>
<br><<link "Return to Market" "Market">><<set $pe to 0>><</link>>
<br>You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<if $purchase neq null>>
<p style="color:#ff69b4; font-weight:bold; text-align:center; margin:20px 0;">
You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<</if>>
<</nobr>>
<<nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Offering</th>
<th style="width:180px;">Description</th>
<th style="width:120px;">Price</th>
<th style="width:100px;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $blissfurnacepavilionInventory.length; _i++>>
<<set _item to $blissfurnacepavilionInventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<<if _item.lewd neq null and _item.lewd>>
<span style="color:#ff69b4; font-size:0.9em;">(Secret Refinement Tool)</span>
<</if>>
</td>
<td><div class="item-desc"><<print _item.description>></div></td>
<td style="text-align:center; vertical-align:middle;">
<span class="item-price"><<print _item.price>> Stones</span>
</td>
<td style="text-align:center; vertical-align:middle;">
<<if _item.price gt $gold>>
<span style="color:#ff4444;">Not enough</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
/* Add to correct inventory */
<<if _item.class is "potion" or _item.class is "consumable">>
<!-- Potions/Consumables -->
<<set _found to false>>
<<for _j range $playerpotioninventory>>
<<if _j.name is _item.name>>
<<set _j.quantity += 1>>
<<set _found to true>>
<<break>>
<</if>>
<</for>>
<<if not _found>>
<<set _new to clone(_item)>>
<<set _new.quantity to 1>>
<<set $playerpotioninventory.push(_new)>>
<</if>>
<<else>>
<!-- Toys/Items (non-consumable) -->
<<set _found to false>>
<<for _j range $playeriteminventory>>
<<if _j.id is _item.id>>
<<set _found to true>>
<<break>>
<</if>>
<</for>>
<<if not _found>>
<<set $playeriteminventory.push(clone(_item))>>
<</if>>
<</if>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<</nobr>>
<<elseif $pe eq 23>>
<<set _meiLingPresent to random(100) gte 50>> /* 50% chance she's absent */
<p>You recline on a heated jade table as Phoenix Tears Oil warms your skin, unblocking meridians...</p>
<<if _meiLingPresent>>
<<goto "Market">><<set $pe to 24>>
<<else>>
<<goto "Market">><<set $pe to 25>>
<</if>>
<<elseif $pe eq 24>>
Mei Ling expertly massages your body, her hands skilled in the art of yin-yang harmony. You feel waves of pleasure and relaxation wash over you as she works her magic.
<<link "Finish the massage" "Market">><<set $pe to 0>><</link>>
<<elseif $pe eq 25>>
<<nobr>>
Lian Feng, a young alchemist , bows deeply: <span class="male1">"Mei Ling rests from qi deviation, honored guest. I shall serve with utmost care."</span>
<p>You lie face-down on the warm jade table, silk towel draped loosely over your hips. The chamber smells of sweet incense and heated oil. Lian Feng stands at your side, pouring Phoenix Tears Oil into his palms.</p>
<p><span class="male1">"Long day of cultivation?"</span> he asks, voice low and steady. <span class="male1">"Your shoulders are knotted tight. Just relax... I'll work it out."</span></p>
<p>His hands land firm on your upper back - strong, callused thumbs digging into tense muscles. The oil is hot, sinking deep. You let out a soft sigh without meaning to.</p>
<p>He pauses for a second. <span class="male1">"There... feel that? Qi starting to move already."</span></p>
<<linkreplace "Murmur 'That feels good'">>
<p><span class="player">"That feels good,"</span> you say softly.</p>
<p>He chuckles quietly. <span class="male1">"Glad to hear it. Let's keep the flow steady."</span></p>
<p>His hands stay focused - long strokes down your spine, pressing along arms and legs. No wandering. Just pure relief as blocked meridians open.</p>
<div class="success-alert">+50 EXP | Full Qi restored </div>
<br><<gainExp 40 70>>
<<set $energy to $maxenergy>>
<br><<link "Thank him and leave" "Market">><<set $pe to 0>><</link>>
<br><<link "Stay quiet and breathe" "Market">><<set $pe to 26>><</link>><br>
<</linkreplace>>
<</nobr>>
<<elseif $pe eq 26>>
<<nobr>>
<p>You stay quiet, letting your breathing deepen. Lian Feng’s hands slow, becoming more deliberate. His palms slide lower, thumbs brushing the sides of your breasts with each pass.</p>
<p><span class="male1">"Skin like silk,"</span> he mutters, almost to himself. One hand drifts to your ribcage, fingers grazing the soft swell underneath.</p>
<p>Your breath catches - a tiny shiver runs through you. He feels it.</p>
<p><span class="male1">"Sensitive here, huh?"</span> His voice is rougher now, closer to your ear. <span class="male1">"The oil brings everything to the surface."</span></p>
<<set _massageChoice to null>> /* Temporary variable for this decision */
<div id="massage-choices">
<<if $corruption gte 10>>
<<link "Let him continue...">>
<<replace "#massage-choices">>
<p>His confidence grows. The towel slides lower as he works your hips - fingers slipping under the edge, kneading the top of your ass. A low groan escapes you.</p>
<p><span class="male1">"Fuck... you're soaked already,"</span> he whispers, surprised. His palm cups one cheek fully now, squeezing slow. The other hand glides up your side, thumb brushing your nipple as it hardens.</p>
<p><span class="male1">"Tell me to stop if you want,"</span> he says, voice thick, <span class="male1">"but your body's saying something else."</span></p>
<img src="images/Sex/massage.webp" class=center width=600>
<p>Heat pools between your legs.</p>
<p><span class="male1">"Beautiful,"</span> he breathes. One hand spreads your thighs wide; the other traces your folds - finding you already wet.</p>
<div id="massage-choices1">
<<link "That's enough!">><<set $pe to 0>>
<<replace "#massage-choices1">>
<p>You grab his wrist. <span class="player">"That's enough."</span></p>
<p>He stops instantly, breathing hard. <span class="male1">"My apologies."</span> Session ends respectfully.</p>
<div class="success-alert">+70 EXP</div>
<br><<gainExp 40 70>>
<<link "Leave">><<goto "Market">><<if $corruption lt 27>><<set $corruption += 1>><</if>><<set $sexFame += random(2,4)>><<set $pe to 0>><</link>>
<</replace>>
<</link>>
<<if $corruption gte 25>><<link "Let him continue" "Market">><<set $pe to 27>><</link>><</if>>
</div>
<</replace>>
<</link>>
<<link "Protest now">>
<<replace "#massage-choices">>
<p>You shift slightly. <span class="player">"Lian Feng... stick to the meridians."</span></p>
<p>He pulls back at once, clearing his throat. <span class="male1">"Right. My mistake."</span> Hands return to safe territory - firm, professional strokes only.</p>
<br><<gainExp 40 70>>
<<link "Finish up" "Market">><<set $pe to 0>><<if $corruption lt 30>><<set $corruption += 1>><</if>><<set $sexFame += random(2,4)>><</link>>
<</replace>>
<</link>>
<<else>>
<<replace "#massage-choices">>
<p>You tense and speak firmly. <span class="player">"Lian Feng... stick to the meridians."</span></p>
<p>He withdraws immediately. <span class="male1">"Of course. Forgive me."</span> The rest of the massage stays strictly professional.</p>
<br><<gainExp 40 70>>
<<link "Finish up" "Market">><<set $pe to 0>><<if $corruption lt 30>><<set $corruption += 1>><</if>><<set $sexFame += random(2,4)>><</link>>
<</replace>>
<</if>>
</div>
<</nobr>>
<<elseif $pe eq 27>>
<<nobr>>
<p>His fingers slide inside you - slow at first, then deeper, curling just right. You gasp as he adds a second, stretching you.</p>
<img src="images/Sex/massage1.webp" class="nsfw-glow">
<p><span class="male1">"Fuck, you're tight,"</span> he groans. Thumb circles your clit while his fingers pump steadily. Your hips buck; wetness coats his hand.</p>
<p>He flips you back over, ass in the air. Strong hands grip your cheeks, spreading you open as three fingers thrust deep from behind.</p>
<img src="images/Sex/massage2.webp" class="nsfw-glow">
<p>You moan into the table, pushing back against his hand. He growls, <span class="male1">"You want more, don't you?"</span></p>
<div id="massage-choices">
<<if $corruption gte 30>>
<<link "Let him continue...">>
<<replace "#massage-choices">>
<p>Lian Feng can't hold back anymore. He sheds his robe - cock thick and hard, dripping at the tip. He lines up behind you, rubbing against your soaked entrance.</p>
<p><span class="male1">"Need to be inside you,"</span> he says roughly, pushing in slow. You cry out as he stretches you completely.</p>
<img src="images/Sex/massage3.webp" width="60%" class="nsfw-glow">
<p>He starts thrusting - deep, steady strokes that make the table creak. Hands grip your hips hard, pulling you back onto him with every slam.</p>
<p><span class="male1">"So fucking good,"</span> he groans. Pace turns brutal - skin slapping, oil flying. You push back desperately, taking him deeper.</p>
<p>Pleasure builds fast. You come hard, walls clenching around him. He follows with a roar, burying deep and filling you with hot pulses.</p>
<p>Qi explodes between you - pure yang flooding yin in perfect harmony.</p>
<div class="success-alert" style="color:#ff4500;">
+80 EXP
</div>
<br><<gainExp 60 100>>
<<if $corruption lt 50>><<set $corruption += 2>><<set $sexFame += random(2,4)>><</if>>
<<link "Collapse spent">><<goto "Market">><<if $virginity eq 1>><<set $virginity = 0>><<set $virginityLost = "Masseur">><<set $sexFame += random(2,4)>><</if>><<set $pe to 0>><<set $humanSexCount += 1>><</link>>
<</replace>>
<</link>>
<</if>>
<<link "Protest now">>
<<replace "#massage-choices">>
<p>You shake your head. <span class="player">"Stop... please."</span></p>
<p>He pulls out slowly, breathing ragged. <span class="male1">"As you wish."</span> Massage ends here.</p>
<br><<gainExp 40 70>>
<<link "Leave flushed">><<goto "Market">><<set $pe to 0>><<set $sexFame += random(2,4)>><<if $corruption lt 37>><<set $corruption += 1>><</if>><</link>>
<</replace>>
<</link>>
</div>
<</nobr>>
<<elseif $pe eq 28>>
<<nobr>>
<<if $corruption lt 15>>
<p>The alchemist leads you to a silk-draped side chamber lined with polished jade artifacts of various shapes and sizes.</p>
<p><span class="male1">"These are personalized meridian probes,"</span> he explain calmly. <span class="male1">"Crafted to fit your body's unique qi flow. They help relieve stress, unblock stagnant meridians, and refine yin essence in private cultivation."</span></p>
<p><span class="male1">"Many disciples use them for solo refinement. Nothing shameful - merely a tool for progress."</span></p>
<p>You nod, understanding the purpose, but feel a faint warmth in your cheeks. The idea is... intriguing, yet you are not quite ready to indulge.</p>
<p><i>(Requires Corruption 15+ to proceed with fitting)</i></p>
<br><<link "Go back" "Market">><<set $pe to 0>><</link>>
<<else>>
<p>The alchemist guides you behind heavy silk curtains into a warmly lit fitting chamber. Dozens of jade artifacts gleam on velvet cushions - smooth rods, tapered plugs, beaded chains, all pulsing faintly with contained qi.</p>
<p><span class="male1">"Welcome to true personalization,"</span> he say with a knowing smile. <span class="male1">"We will measure your meridians and craft a probe perfectly suited to your body. It will become your most intimate cultivation tool."</span></p>
<p>You feel heat rising - not from embarrassment, but anticipation. Your corruption has awakened curiosity you can no longer deny.</p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<h3 style="color:#ff69b4; margin:30px 0 20px;">Choose Your Artifact Type</h3>
<<set _customfittingblissfurnaceinventory to []>>
<<set _customfittingblissfurnaceinventory.push($jadeprobe, $phoenixfeatherplug, $lotusbeads
)>>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:25px; margin-bottom:30px;">
<<for _i to 0; _i lt _customfittingblissfurnaceinventory.length; _i++>>
<<set _item to _customfittingblissfurnaceinventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
<span style="color:#ff1493; font-size:0.9em;">(Private Yin Refinement Tool)</span>
</td>
<td style="text-align:center;">
<<print 350>> Stones<br>
<span style="font-size:0.9em; color:#ff69b4;">+ Personal Fitting</span>
</td>
<td style="text-align:center;">
<<if $gold lt 350>>
<span style="color:#ff4444;">Not enough</span>
<<elseif $corruption lt 15>>
<span style="color:#ff69b4;">(Corruption 15+ required)</span>
<<else>>
<<capture _item>>
<<link "Purchase & Fit">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playeriteminventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= 350>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<<goto "Market">><<set $pe to 29>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
<</if>>
<</nobr>>
<<elseif $pe eq 29>>
<<nobr>>
<p><span class="male1">"Now... let us ensure perfect fit."</span></p>
<p>The alchemist closes the silk curtain behind you, sealing the chamber in warm, dim light scented with aphrodisiac incense.</p>
<p><span class="male1">"For true personalization,"</span> he say in a low, professional tone, <span class="male1">"we must first measure your body's natural response. Lie back on the jade table and relax."</span></p>
<p>You recline as instructed. The cool stone against your bare back sends a shiver through you. The alchemist gently lifts your knees and spreads your legs wide, exposing you completely to their calm, practiced gaze.</p>
<img src="images/Sex/toyfitting.webp" class="nsfw-glow">
<p>Strong hands hold your thighs open as they lean in close, studying every intimate detail with clinical focus that gradually turns heated.</p>
<p><span class="male1">"Beautiful structure,"</span> he murmur, voice dropping. <span class="male1">"Petals flushed and already glistening. Your yin gate responds eagerly to exposure."</span></p>
<p>A gloved finger traces your outer lips lightly, parting them to reveal the slick pink within. You bite your lip as cool air meets wet heat.</p>
<p><span class="male1">"Sensitive here,"</span> he note, brushing your swollen clit once - just enough to make your hips twitch. <span class="male1">"And here..."</span> Two fingers spread you wider, opening your entrance fully to inspection.</p>
<p>He press gently at your hole, testing resistance. <span class="male1">"Tight, yet yielding. Perfect depth for deep refinement. You will take a full probe easily."</span></p>
<p>Another slow circle around your clit, deliberate now. <span class="male1">"Natural lubrication abundant. Your body is ready for pleasure cultivation."</span></p>
<p>Finally, he withdraws, eyes dark with restrained hunger. <span class="male1">"Measurements complete. Your meridians sing with need."</span></p>
<<set $corruption += random(2,3)>>
<<set _lastToy to $purchase>> <!-- Uses the name from purchase -->
<<linkappend "The alchemist presents your custom <<print $purchase>>">>
- perfectly matched to your depth and girth preference.
<<if _lastToy eq "Jade Meridian Probe">>
<p><span class="male1">"Use it freely in private. It will bring powerful yin refinement... and pleasure."</span></p>
<<elseif _lastToy eq "Phoenix Feather Anal Plug">>
<p><span class="male1">"This one will awaken your rear meridians,"</span> he murmurs. <span class="male1">"Breathe slow and push back when you feel pressure."</span></p>
<p>You feel the cool tip press against your tight ring. A steady, gentle push follows - the jade slides in smoothly, stretching you open inch by inch until the widest part pops past the resistance and seats deep inside.</p>
<p>Warm yang fire instantly spreads through forbidden channels. The soft feathers brush your sensitive skin with every tiny movement, sending shivers up your spine.</p>
<p><span class="male1">"Perfect fit,"</span> he praises, giving the base a light tug that makes you gasp. <span class="male1">"Your body accepts it greedily."</span></p>
<<elseif _lastToy eq "Lotus Prayer Beads">>
<p>The alchemist lays out the string of graduated rose quartz beads, each one larger than the last, polished to a silky sheen.</p>
<p><span class="male1">"We insert them one by one,"</span> He explains softly. <span class="male1">"Feel each bead stretch and settle before the next."</span></p>
<p>Cool oil drips between your cheeks. The smallest bead presses in easily - then the next, larger one forces a soft moan from your lips as it stretches your ring wider.</p>
<p>One after another they disappear inside you, each pop sending a pulse of yin qi through your body. By the time the largest bead seats deep, you feel deliciously full, every slight shift tugging at sensitive nerves.</p>
<p>The alchemist gives the loop at the end a gentle pull - the beads shift inside, making your hips buck involuntarily.</p>
<p><span class="male1">"Exquisite response,"</span> he whispers. <span class="male1">"Your meridians are wide open now."</span></p>
<</if>>
<p>You acquired: _lastToy</p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<</linkappend>>
<</nobr>>
<<elseif $pe eq 30>>
<<set $corruption += random(2,3)>>
<<linkappend "The alchemist carefully coats the tapered jade plug.">>
<p><span class="male1">"This one will awaken your rear meridians,"</span> they murmur. <span class="male1">"Breathe slow and push back when you feel pressure."</span></p>
<p>You feel the cool tip press against your tight ring. A steady, gentle push follows - the jade slides in smoothly, stretching you open inch by inch until the widest part pops past the resistance and seats deep inside.</p>
<p>Warm yang fire instantly spreads through forbidden channels. The soft feathers brush your sensitive skin with every tiny movement, sending shivers up your spine.</p>
<p><span class="male1">"Perfect fit,"</span> they praise, giving the base a light tug that makes you gasp. <span class="male1">"Your body accepts it greedily."</span></p>
<p>You acquired: Phoenix Feather Anal Plug<br></p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<</linkappend>>
<<elseif $pe eq 31>>
<<set $corruption += random(2,3)>>
<<linkappend "The alchemist lays out the string of graduated rose quartz beads">>, each one larger than the last, polished to a silky sheen.
<p><span class="male1">"We insert them one by one,"</span> they explain softly. <span class="male1">"Feel each bead stretch and settle before the next."</span></p>
<p>Cool oil drips between your cheeks. The smallest bead presses in easily - then the next, larger one forces a soft moan from your lips as it stretches your ring wider.</p>
<p>One after another they disappear inside you, each pop sending a pulse of yin qi through your body. By the time the largest bead seats deep, you feel deliciously full, every slight shift tugging at sensitive nerves.</p>
<p>The alchemist gives the loop at the end a gentle pull - the beads shift inside, making your hips buck involuntarily.</p>
<p><span class="male1">"Exquisite response,"</span> they whisper. <span class="male1">"Your meridians are wide open now."</span></p>
<p>You acquired: Lotus Prayer Beads<br></p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<</linkappend>>
<</if>><<if $pe eq 0>>
<img src="images/Locations/BathHouse.jpg" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
You step beneath the curved archway of the bathhouse, where steam curls lazily from the open roof. The scent of lotus flowers and mineral-rich springs wafts through the air, blending with the warm aroma of aged wood and faint medicinal herbs.
A delicate chime rings above the entrance as you push aside the bamboo curtain. Inside, soft light glows from spirit stones embedded in the walls, casting gentle reflections on the polished stone floor.
<<set _random to random(0,1)>>\
<<if _random eq 0>>\
Behind a low counter sits a slender woman in light crimson robes, a jade ornament pinned to her hair. Her eyes lift to meet yours—measured, slightly amused, and unmistakably aware of your gaze.
<span class="female">"Welcome to the Moonveil Springs, traveler. You look like you’ve carried dust and spirit strain from the road... or a fight."</span>
She gestures toward a lacquered board displaying prices written in flowing calligraphy.
<span class="female">"Private pool: ten spirit stones. Communal bath: three."</span>
<<else>>\
Behind a low wooden counter sits a man in dark, well-fitted robes. His sleeves are loosely rolled up, revealing calloused forearms marked with faint spirit script. A single strand of black hair falls across his sharp eyes as he regards you—calm, calculating, with the faintest hint of a smirk tugging at his lips.
<span class="male">"You’ve got the look of someone who’s fought more than just beasts today."</span>
He leans forward slightly, voice smooth like aged wine.
<span class="male">"Communal bath is three spirit stones. Private spring’s ten."</span>
<</if>>
<<link "Go back" $passage>><<set $pe to 0>><</link>>
<<linkappend "Private Bath">>
<<if $gold gte 10>><<goto "Public Baths">>
<<set $pe to 1>>
<<set $gold -=10>>
<<else>>You don't have enough spirit stones!<</if>>
<</linkappend>>
<<linkappend "Communal bath">>
<<if $corruption gt 10 and $gold gte 3>><<goto "Public Baths">><<set $pe=10>><<elseif $corruption gt 10 and $gold lt 3>>You don't have enough spirit stones!<<elseif $corruption lte 10>><span class="player">What am I even thinking?</span><</if>>
<</linkappend>>
<<elseif $pe eq 1>>
The attendant leads you to a side corridor and slides open a paper door carved with phoenix patterns.
Inside, the private spring glows faintly from embedded spirit stones. Mist curls around the edges of the stone pool like spirit snakes. The scent of plum blossoms and sandalwood fills the air.
<<linkappend "You’re finally alone.">>
You step onto the smooth stone floor beside the steaming water. The silence is calming. Your fingers trace the knot of the towel at your hip.
<span id="choice1">
<<linkreplace "Gently lower yourself into the water, towel still on.">>
<<replace "#choice2">><</replace>>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;">
<img src="images/Sex/bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
You let the warmth soak through the cloth, your body relaxing slowly. The towel floats faintly around you, growing more transparent with every second. A quiet moment of solitude. You close your eyes and breathe in deep.
<span class="healthy">You've recovered part of your health and qi.</span>
<<if $health lt $maxhealth or $energy lt $maxenergy>><<set $health to ($health += $health*0.1)>> <<set $energy to ($energy += $energy*0.1)>><<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>><<if $energy gte $maxenergy>><<set $energy to $maxenergy>><</if>><</if>>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><</link>>
<</linkreplace>>\
</span>\
\
<span id="choice2">
<<linkreplace "Remove the towel, letting it fall before entering naked.">>\
<<replace "#choice1">><</replace>>\
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>><<if _random eq 0>>
<img src="images/Sex/nakedbath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<else>><img src="images/Sex/nakedbath1.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><</if>>
</div>
With a flick of your fingers, the towel slides down your body and falls silently to the floor. The air brushes your bare skin, and the rising steam embraces you like a lover’s breath.
You step into the water, feeling the heat soak into every part of you. Free. At peace.
You settle against the smooth stone edge, letting your arms drape lazily over the rim. Steam clings to your skin in droplets, tracing paths down the gentle curves of your breasts, the dip of your stomach, the soft flesh between your thighs.
<span class="healthy">You've recovered part of your health and qi.</span>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><</link>>
<<if $health lt $maxhealth or $energy lt $maxenergy>><<set $health to ($health += $health*0.1)>> <<set $energy to ($energy += $energy*0.1)>><<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>><<if $energy gte $maxenergy>><<set $energy to $maxenergy>><</if>><</if>>
<<linkappend "You feel a slow, warm ache between your thighs...">>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>>
<img src="images/Sex/masturbation_bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
Your fingers drift underwater, trailing along your inner thigh. There’s no one here.
Your hand slides between your legs, parting the folds of your pussy with practiced ease. The water only amplifies the sensation—heat kissing your skin, your clit pulsing softly under your touch.
You circle it slowly, teasing yourself with delicate strokes. Pleasure flutters through your core, subtle at first… but growing. You tilt your head back, lips parting with a quiet sigh as you press in deeper.
Two fingers slip past your entrance, spreading your slick folds beneath the surface. You curl them slightly inside yourself, your breath catching as you hit just the right spot. The soft slap of water echoes faintly with every motion of your hips. The rhythm builds—slow, wet, steady.
Your free hand cups your breast, thumb brushing across a hardened nipple. You moan this time—quiet but unashamed. The sound disappears into the steam, claimed by the silence of the room.
Each thrust of your fingers drives the heat higher. Your clit throbs beneath your touch, swollen and needy, aching for release. You rub it faster now, your thighs tensing around your hand.
Pressure coils inside you—tight, hot, irresistible. The peak rushes toward you like qi flooding a meridian.
And then—
You come with a soft cry, legs trembling in the water, pleasure tearing through you like a quiet storm. Your back arches, your walls clenching greedily around your fingers as wave after wave crashes through your body.
You collapse back against the stone, chest rising and falling, fingers still lazily nestled between your thighs.
The water calms again, rippling gently as if it too is catching its breath.
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><<if $corruption lt 15>><<set $corruption +=1>><</if>><</link>>
<</linkappend>>
<</linkreplace>>\
</span>\
<</linkappend>>
<<elseif $pe eq 10>>
You step into the steamy chamber of the communal bath. The room is filled with the soft murmur of voices, the splash of water, and the scent of heated minerals.
Smooth stone tiles line the hot spring pool, its edges decorated with dragon-shaped spouts that pour steaming water into the crystal-clear basin. A handful of cultivators lounge in the pool—some meditating in silence, others casually conversing in hushed tones.
You feel the warmth wrap around your body through the thin bath towel provided. Moisture clings to your skin already, making it stick slightly. A few glances are thrown your way, subtle and brief… though one lingers.
You approach the water’s edge.
<span id="choice1">
<<linkreplace "Keep the towel on and slide into the water.">>
<<replace "#choice2">><</replace>>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;">
<img src="images/Sex/bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
You sink into the warmth slowly, the towel still clinging loosely to your body. It becomes translucent as it soaks, and you catch more than one curious glance from the others. Whether it's respect or something else, it's hard to tell in the rising steam.
<span class="healthy">You've recovered part of your health and qi.</span>
<<if $health lt $maxhealth or $energy lt $maxenergy>><<set $health to ($health += $health*0.1)>> <<set $energy to ($energy += $energy*0.1)>><<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>><<if $energy gte $maxenergy>><<set $energy to $maxenergy>><</if>><</if>>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><<if $corruption lt 25>><<set $corruption +=1>><</if>><</link>>
<</linkreplace>>\
</span>\
\
<span id="choice2">
<<linkreplace "Let the towel fall and step in naked.">>\
<<replace "#choice1">><</replace>>\
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>><<if _random eq 0>>
<img src="images/Sex/nakedbath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<else>><img src="images/Sex/nakedbath1.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><</if>>
</div>
You untie the towel and let it drop to the smooth stone without hesitation. The steam caresses your bare skin as you step confidently into the water. A nearby cultivator—one with a jade pin in her hair—lets her eyes flick to you briefly, then back again.
<span class="female">"Brave or bold,"</span> she murmurs to herself, just loud enough for you to hear.
You settle into the warm waters, letting the steam and heat melt away tension from your limbs. The crystalline surface ripples as you stretch, utterly bare beneath the rising mist. Around you, soft conversations drift in and out like incense smoke, but your mind floats in calm silence.
<span class="healthy">You've recovered part of your health and qi.</span>
<<set _chance = random(0,100)>>
<<if _chance lte 99>>
Until someone joins you.
<img src="images/Sex/bathev.webp" style="width: 100%">
The water shifts subtly. A figure enters the pool on your left—tall, well-built, his bare torso still glistening from the mist. His face is unfamiliar, but his gaze lingers just a little too long on your body before he speaks.
<span class="male">"Didn’t think I’d find someone so bold in a place like this,"</span>he says, voice smooth like oiled silk, with a smirk that suggests he's no stranger to indulgence.
<span class="male">"Not every day you see someone that comfortable in their skin... but I like it."</span>
He leans in slightly, not close enough to touch, but close enough to make his presence feel intentional.
His tone lowers, just enough to make it feel <i>sensual</i>.
<span class="male">"You look like someone who knows how to... ease tension. How about lending a hand? I’ll make it worth your while."</span>
He shifts beneath the water slightly. From the faint ripples—and the way his eyes lock on yours—you know exactly what he means.
<div id="choice3">
<<if $corruption gt 25>><<link "Accept his offer and reach beneath the water.">>
<<replace "#choice3">>
<<set _randomHJ =random(0,3)>>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>><<if _randomHJ eq 0>>
<img src="images/Sex/handjob_bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<elseif _randomHJ eq 1>><img src="images/Sex/handjob_bath1.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<elseif _randomHJ eq 2>><img src="images/Sex/handjob_bath2.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<elseif _randomHJ eq 3>><img src="images/Sex/handjob_bath3.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><</if>>
</div>
The water around you shifts as you scoot a little closer, letting your knee brush against his beneath the surface. His smirk fades, replaced with a breathless stillness as he watches your hand disappear beneath the steaming surface.
Your fingers glide across the warmth of his thigh—firm, tense—before you wrap them slowly around his cock. Hard. Hot. Already twitching with need beneath the water.
He exhales sharply. <span class="male">“Fuck…”</span>
The sound of it, ragged and low, makes heat coil in your belly.
You stroke him slowly at first, your movements masked by the gentle ripples of the bathwater.
His head tips back slightly, jaw tight, chest rising with sharp breaths.
<span class="male">"Shit—gods, your hand…"</span> he mutters, voice hoarse. <span class="male">"You're better than half the courtesans in Golden Silk Pavilion..."</span>
You smirk, your fingers tightening just slightly, giving him a slow, deliberate pump that earns a low groan from his throat.
Around you, the bathhouse continues—unaware or uncaring of what’s happening just beneath the surface. Maybe someone knows. Maybe they’re watching.
He shifts closer, one hand gripping the edge of the stone, muscles taut.
<span class="male">“Fuck—don’t stop. Just like that...”</span>
Your strokes grow faster, firmer. His cock throbs in your hand, slick now from a mix of precum and water, and you feel him twitch violently as his breath grows uneven.
<span class="male">"I'm gonna—fuck—"</span>
He jerks forward just slightly, and with a soft grunt, he spills into the water—hot spurts lost in the steam, his hips trembling beneath your hand.
You let go slowly, dragging your fingers up his length one last time before retracting your hand, watching the way his chest heaves and his lips part with dazed satisfaction.
He leans in, whispering with a lopsided grin.
<span class="male">“Remind me never to underestimate anyone in this bathhouse again.”</span>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><<set $sexFame += random(2,4)>><<if $corruption lt 35>><<set $corruption +=1>><</if>><</link>>
<</replace>><</link>><</if>>
<<if $corruption gt 10>><<link "Smirk but only tease him">>
<<replace "#choice3">>
You give him a slow look, deliberately trailing your gaze down his chest.
<span class="player">"You’ll have to try harder than that to earn a touch from me."</span>He chuckles, raising his hands in mock surrender.
<span class="male">"Fair enough. But I’m not giving up just yet."</span>
<<link "Finish bathing" "Public Baths">><<set $sexFame += 1>><<set $pe to 0>><<if $corruption lt 15>><<set $corruption +=1>><</if>><</link>>
<</replace>> <</link>><</if>>
<<link "Politely decline">>
<<replace "#choice3">>
You meet his eyes and offer a calm smile.
<span class="player">"I came here to relax, not to serve."</span>
He raises an eyebrow but nods, backing off without offense.
<span class="male">"Respect. Maybe another time, then."</span>
<<link "Finish bathing" "Public Baths">> <<set $pe to 0>> <</link>>
<</replace>><</link>>
</div>
<<else>>
No one interfered with your relax...
<<link "Finish bathing" "Public Baths">><<set $pe to 0>> <</link>>
<</if>>
<</linkreplace>>\
</span>\
\
\
\
<</if>><<set _currentpassage to passage()>>
<<print $PlayerLocation>>
<<if $pe eq 0>>
<br>The air is thick with the scent of spiritual wine and the low hum of cultivators discussing the Dao.
<br><<if $fame gt 50>>
The rowdy crowd settles as you enter. A few rogue cultivators nudge each other, whispering about your recent exploits.
<br><<else>>
No one looks up as you enter. To them, you are just another wandering soul seeking a moment's respite.
<</if>>
<hr>
<div id="gossip-area">
<<link "Buy a jar of wine and listen to gossip (5 Spirit Stones)">>
<<set $gold -= 5>>
<<set $energy += 5>>
<<replace "#gossip-area">>
<<TavernGossip>>
<</replace>>
<</link>>
</div>
<<set _roll to random(1, 100)>>
<<if _roll lte 15>>
/* Positive Outcome */
<p>A troupe of musicians plays a song of the ancient Sects. The harmonic resonance aligns your meridians.</p>
<span class="gold">You feel invigorated! (+10 Energy)</span>
<<set $energy += 10>>
<<elseif _roll lte 30>>
/* Interaction Outcome */
<p>A drunken brute slams his jug down. "You! Woman! You look like you can handle your liquor. Care to bet on a contest?"</p>
<<linkreplace "Accept the challenge">>
<<set _physique to random(1, 10)>>
<<if _physique + ($cultivationLevel) gt 8>>
<p>You drain the jug without blinking. The brute laughs and toasts to your name!</p>
<span class="green">Your fame spreads. (+5 Fame)</span>
<<set $fame += 5>>
<<else>>
<p>The spiritual wine is too potent. Your vision swims, and you collapse into a heap.</p>
<span class="red">How embarrassing. (-5 Energy, -2 Fame)</span>
<<set $energy -= 5>><<set $fame -= 2>>
<</if>>
<</linkreplace>>
<<elseif _roll lte 45>>
/* Trigger the Arrogant Young Master */
<p>The atmosphere suddenly chills. A young man in silk robes is berating a server. His eyes lock onto you with predatory interest.</p>
<<link "Approach the commotion" "Arrogant Young Master Tavern">><<set $pe to 0>><</link>>
<<else>>
<p>It is a quiet night. You find a corner to meditate and listen to the local gossip.</p>
<</if>>
<<GenerateEncounterBatch "tavern">>
<<DisplayEncounter>>
<hr>
<<link "Rest at a table (Cost: 5 Spirit Stones)" $passage>>
<<set $gold -= 5>><<set $energy += 20>>
<</link>>
<br><<link "Leave the tavern" $city>><<set $pe to 0>><</link>>
<</if>><h1 style="text-align:center; color:#d4af37; border-bottom: 2px ridge #d4af37;">Celestial Alchemy Cauldron</h1>
<p class="flavor-text">A faint hum of spiritual energy emanates from the bronze tripod. Ancient runes glow along the walls as you prepare your ingredients.</p>
<div id="craftlog"></div>
<<if $knownRecipes.length gt 0>>
<<nobr>>
/* State Management */
<<set $workshopPage to $workshopPage ?? 1>>
<<set $workshopFilter to $workshopFilter ?? "All">>
<<set _itemsPerPage to 5>>
/* 1. Gather Tags for Filters */
<<set _availableTags to ["All"]>>
<<for _recipe range $knownRecipes>>
/* Using your new 'tag' variable from the potion object */
<<set _tag to _recipe.result.tag ?? "Misc">>
<<if not _availableTags.includes(_tag)>>
<<run _availableTags.push(_tag)>>
<</if>>
<</for>>
/* 2. Filter Logic */
<<set _filteredRecipes to []>>
<<for _recipe range $knownRecipes>>
<<if $workshopFilter eq "All" or _recipe.result.tag eq $workshopFilter>>
<<run _filteredRecipes.push(_recipe)>>
<</if>>
<</for>>
/* 3. Pagination Math */
<<set _maxPage to Math.max(1, Math.ceil(_filteredRecipes.length / _itemsPerPage))>>
<<set _startIndex to ($workshopPage - 1) * _itemsPerPage>>
<<set _displayRecipes to _filteredRecipes.slice(_startIndex, _startIndex + _itemsPerPage)>>
/* 4. Filter UI */
<div class="filter-bar">
<span style="color:#8b7332; margin-right:10px;">◈ Category ◈</span>
<<for _tag range _availableTags>>
<<capture _tag>>
<<if $workshopFilter eq _tag>>
<span class="filter-link active-filter">_tag</span>
<<else>>
/* Fixed passage error by using 'goto' inside link */
<<link _tag>>
<<set $workshopFilter to _tag>>
<<set $workshopPage to 1>>
<<goto `passage()`>>
<</link>>
<</if>>
<</capture>>
<</for>>
</div>
/* 5. The Table */
<table class="alchemy-table">
<tr>
<th>Pill Name</th>
<th>Required Essence</th>
<th>Action</th>
</tr>
<<if _displayRecipes.length eq 0>>
<tr><td colspan="3" style="text-align:center;">No scrolls found in this category.</td></tr>
<<else>>
<<for _recipe range _displayRecipes>>
<<capture _recipe>>
<tr>
<td>
<span class="recipe-name"><<print _recipe.name>></span><br>
<span style="font-size: 0.85em; color: #aaa;"><i><<print _recipe.result.description>></i></span>
</td>
<td>
<<for _id, _qty range _recipe.ingredients>>
<<set _itemName to _id.replace(/([a-z])([A-Z])/g, "$1 $2").toUpperFirst()>>
<span class="ingredient-item" style="color:#a8d5a8;">
🌿 _qty x _itemName
</span><br>
<</for>>
</td>
<td style="text-align:center;">
<<link "Commence Refining">>
<<craftItem _recipe>>
<</link>>
</td>
</tr>
<</capture>>
<</for>>
<</if>>
</table>
/* 6. Pagination Controls */
<div style="text-align: center; margin-top: 20px; font-family: serif;">
<<if $workshopPage gt 1>>
<<link "🠔 Previous Scroll">>
<<set $workshopPage -= 1>>
<<goto `passage()`>>
<</link>>
<<else>>
<span style="color: #444;">🠔 Previous Scroll</span>
<</if>>
<span style="margin: 0 20px; color:#d4af37;">Page $workshopPage of _maxPage</span>
<<if $workshopPage lt _maxPage>>
<<link "Next Scroll 🠖">>
<<set $workshopPage += 1>>
<<goto `passage()`>>
<</link>>
<<else>>
<span style="color: #444;">Next Scroll 🠖</span>
<</if>>
</div>
<</nobr>>
<<else>>
<p>Your mind is empty of pill formulas. Seek out alchemical manuals before returning to the cauldron.</p>
<</if>>
<br>
<div style="text-align:center;">
<<link "Leave the Cauldron Room" $passage>>
<<unset $workshopPage, $workshopFilter>>
<</link>>
</div><img src="images/Locations/portal.jpg" class="location-bg" style="width:50%; border: 1px solid #c5a059; border-radius: 0;">
<<link "Go back" $passage>><</link>>
You're currently at $region
From this place you can use portal to:
<<set _destinations = [
{name:"Ghost King Netherworld Sect", region:"Ghost King Netherworld Sect", passage:"GhostKingNetherworldSect", x:9, y:12},
{name:"Clear Sky Azure Dragon Pavilion", region:"Clear Sky Azure Dragon Pavilion", passage:"ClearSkyAzureDragonPavilion", x:1, y:6},
{name:"Jade Creek Town", region:"Jade Creek Town", passage:"Jade Creek Town", x:2, y:12}
]>>
<p>You stand before a glowing portal. Where will you go?</p>
<<nobr>>
<<for _d range _destinations>>
<<if $region !== _d.region>>
<<if $gold >= 25>>
<li>
<<capture _d>>
<<link "Teleport to ">>
<<set $gold -= 25>>
<<set $region = _d.region>>
<<set $playerX = _d.x>>
<<set $playerY = _d.y>>
<<goto _d.passage>>
<</link>> (Cost: 25 gold) _d.name
<</capture>>
</li>
<<else>>
<li><span style="opacity:0.5">Teleport to [_d.name] (Not enough gold!)</span></li>
<</if>>
<<else>>
<li><span style="opacity:0.5">Already at [_d.name]</span></li>
<</if>>
<</for>>
<</nobr>>[[Go back->ClearSkyAzureDragonPavilion]]
<div class="sect-info">
<h2>Clear Sky Azure Dragon Pavilion</h2>
<p><b>Sect Purpose:</b> Defending humanity from demonic beasts.</p>
<p><b>Sect Rules:</b> Do not harm the innocent.</p>
<hr>
<p><b>Your Position:</b></p>
<<if $CurrentPcMainSect != "Azure Dragon Sect" and $CurrentPcMainSect != "Ghost King Netherworld Sect">>
<<link "Join the Sect">>
<<goto "Clear Sky Azure Dragon Pavilion Joining Scene">>
<</link>>
<<elseif $CurrentPcMainSect neq "Azure Dragon Sect">>
<ul>
<li><b>You're not part of this sect!</b></li>
</ul>
<<elseif $CurrentPcMainSect == "Azure Dragon Sect">>
<ul>
<li><b>Rank:</b> <<print $CurrentPcSectRank>></li>
<li><b>Reputation:</b> <<print $CurrentPcSectReputation>></li>
</ul>
<</if>>
</div><<if $pe eq 0>>
<<set $returnpassage to passage()>>
<<if $recommendationLetter eq "righteous">>
Variant 1: Player has a recommendation letter
You stand at the entrance of the Clear Sky Azure Dragon Pavilion, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You take a deep breath, clutching the sealed recommendation letter you received earlier. The sect’s disciple eyes the letter, and a respectful nod follows.
“I see you’ve been vouched for. The Pavilion welcomes you.”
With that, he gestures toward the main building, allowing you to pass.
You have been accepted into the sect, your future now intertwined with the Azure Dragon Pavilion.
You may now begin your training and cultivate under their guidance.
<<link "Continue" "ClearSkyAzureDragonPavilion">>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Clear Sky Azure Dragon Pavilion">>
<<set $CurrentPcMainSect to "Azure Dragon Sect">>
<<set $CurrentPcSect to "righteous">>
<</link>>
<<else>>
You stand at the entrance of the Clear Sky Azure Dragon Pavilion, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You approach the entrance, heart racing with excitement at the thought of joining such a prestigious sect. A disciple standing guard raises an eyebrow, looking you over.
“Do you have a recommendation letter from a sect member or higher authority?” Without one, I’m afraid we cannot allow entry into the sect at this time. The path to true cultivation requires both merit and connections. However you may try to enter through duel trial. You'll face one of the sect initiates. If you manage to win, you'll be accepted”
With no recommendation in hand, you feel your chances slipping away. However, the sect is vast, and there may still be a way for you to prove yourself. The choice is yours—find another way to gain favor or try your luck elsewhere.
[[Try another time..->ClearSkyAzureDragonPavilion][$pe=0]]
[[Try through duels!->Clear Sky Azure Dragon Pavilion Joining Scene][$pe=2]]
<</if>>
<<elseif $pe eq 2>>
<<CreateNPC_Region1>>
You stand at the middle of stage, people are watching you.
You'll face _fullname
You can gauge their strength by observing their stance and aura. He is at _realm.
<<BeforeBattle>>
<<set $currentEnemy.sectNPC to "Clear Sky Azure Dragon Pavilion">>
<<link "Attack" "SectEntranceBattle1">><<set $pe to 0>>
<<set $passage to "SectEntranceBattle1">>
<</link>>
<<elseif $pe eq 3>>
<<if $health lte 0>>
Your legs give out as the final blow lands. The stage spins, and everything fades to white.
$currentEnemy.fullname stands tall, their breathing calm but sharp.
"You fought bravely... but you lack experience. Train harder, and perhaps fate will smile upon you next time."
The disciples around the stage whisper, some nodding in respect, others looking unimpressed.
<<link "Leave in shame!" "Map|Region1">><<set $pe to 0>><</link>>
<<elseif $currentEnemy.NPCcurrenthealth lte 0>>
With one final strike, your opponent stumbles backward, collapsing to the stage.
A hush falls over the crowd.
$currentEnemy.fullname grits their teeth. "You... you are strong. The elders were right to test you."
An elder descends from the pavilion steps, his long white beard fluttering in the breeze.
"You have proven your determination and strength through battle. The Clear Sky Azure Dragon Pavilion welcomes you."
<<link "Continue" "ClearSkyAzureDragonPavilion">>
<<set $pe = 0>>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Clear Sky Azure Dragon Pavilion">>
<<set $CurrentPcMainSect to "Azure Dragon Sect">>
<<set $CurrentPcSect to "righteous">>
<</link>>
<</if>>
<</if>><div style="text-align:center;">
<img src="images/Locations/clearskyazure.jpg" class="location-bg" style="width:80%; border: 1px solid #00ced1; box-shadow: 0 0 15px rgba(0, 206, 209, 0.3);">
<h2 class="town-title" style="color:#00ced1; text-shadow: 0 0 10px rgba(0, 206, 209, 0.5);">碧空青龙阁</h2>
<div style="font-size: 0.9em; color: #00ced1; margin-top:-5px;">— Clear Sky Azure Dragon Pavilion —</div>
</div>
<<nobr>>
<<set $passage to passage()>>
<p style="font-style:italic; color:#aaa; text-align:center; max-width:500px; margin: 10px auto;">
The gates of the sect loom before you — ancient, imposing, and pulsing faintly with qi.
Disciples in azure robes patrol the entrance, scrutinizing newcomers.
</p>
<div class="city-grid" style="border-color: #00ced1;">
/* Top Row: Information and Exit */
<<link '<span class="nav-card">📜 Sect Info</span>' "CSADP">><</link>>
<<link '<span class="nav-card exit-btn">⬅ Exit Gates</span>' "Map|Region1">><<set $pe to 0>><</link>>
/* Facility: Hospital */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Hospital (Locked)</span>
<<else>>
<span class="nav-card disabled">Hospital (Locked)</span>
<</if>>
/* Facility: Portal (Usually open to all) */
<<link '<span class="nav-card">🌀 Spirit Portal</span>' "Portal|Stage 1">><<set $pe to 0>><</link>>
/* Facility: Manual Library */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Library (Locked)</span>
<<else>>
<<link '<span class="nav-card">📚 Manual Library</span>' "Manual Library|Stage 1">><<set $pe to 0>><<set $selectedFloor to "Initiate">><</link>>
<</if>>
/* Facility: Treasure Pavilion */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Treasury (Locked)</span>
<<else>>
<<link '<span class="nav-card">💎 Treasure Pavilion</span>' "Treasure Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Mission Hall */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Missions (Locked)</span>
<<else>>
<<link '<span class="nav-card">⚔️ Mission Hall</span>' "Mission Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Spirit Pavilion */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Spirit Pavilion (Locked)</span>
<<else>>
<<link '<span class="nav-card">✨ Spirit Pavilion</span>' "Spirit Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Council Hall (Bottom Span) */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled" style="grid-column: span 2;">Council Hall (Elders Only)</span>
<<else>>
<<link '<span class="nav-card" style="grid-column: span 2;">🏛️ Council Hall</span>' "Council Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Housing */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled" style="grid-column: span 2;">Housing (Locked)</span>
<<else>>
<<link '<span class="nav-card" style="grid-column: span 2;">� Housing</span>' "Housing">><<set $pe to 0>><</link>>
<</if>>
</div>
<<DisplayNPCS "sect" "Clear Sky Azure Dragon Pavilion">>
<</nobr>>[[Go back->GhostKingNetherworldSect]]
<div class="sect-info">
<h2>Ghost King Netherworld Sect</h2>
<p><b>Sect Purpose:</b> To dominate the mortal and spiritual realms.</p>
<p><b>Sect Rules:</b> Never betray the Sect.</p>
<hr>
<p><b>Your Position:</b></p>
<<if $CurrentPcMainSect != "Azure Dragon Sect" and $CurrentPcMainSect != "Ghost King Sect">>
<<link "Join the Sect">>
<<goto "GhostKingNetherworldSectJoiningScene">>
<</link>>
<<elseif $CurrentPcMainSect neq "Ghost King Sect">>
<ul>
<li><b>You're not part of this sect!</b></li>
</ul>
<<elseif $CurrentPcMainSect == "Ghost King Sect">>
<ul>
<li><b>Rank:</b> <<print $CurrentPcSectRank>></li>
<li><b>Reputation:</b> <<print $CurrentPcSectReputation>></li>
</ul>
<</if>>
</div><div style="text-align:center;">
<img src="images/Locations/ghostkingsect.jpg" class="location-bg" style="width:80%; border: 1px solid #9400d3;">
<h2 class="ghostly-title">幽冥鬼王宗</h2>
<div style="font-size: 0.8em; color: #9400d3; margin-top:-5px; letter-spacing: 2px;">— Ghost King Netherworld Sect —</div>
</div>
<<nobr>>
<<set $passage to passage()>>
<p style="font-style:italic; color:#888; text-align:center; max-width:500px; margin: 10px auto; font-size: 0.9em;">
The gates of the sect loom before you — ancient, imposing, and pulsing with a cold, spectral qi.
Disciples clad in dark, flowing robes watch your every move with hollow eyes.
</p>
<div class="city-grid ghostly-grid">
/* Top Row */
<<link '<span class="nav-card">💀 Sect Info</span>' "GKNS">><</link>>
<<link '<span class="nav-card exit-btn">⬅ Exit Gates</span>' "Map|Region1">><<set $pe to 0>><</link>>
/* Facility: Hospital (Currently non-functional based on your code) */
<span class="nav-card disabled">Hospital (Locked)</span>
/* Facility: Portal */
<<link '<span class="nav-card">🌀 Nether Portal</span>' "Portal|Stage 1">><<set $pe to 0>><</link>>
/* Facility: Manual Library */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Forbidden Library (Locked)</span>
<<else>>
<<link '<span class="nav-card">📜 Manual Library</span>' "Manual Library|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Treasure Pavilion */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Treasury (Locked)</span>
<<else>>
<<link '<span class="nav-card">💎 Treasure Pavilion</span>' "Treasure Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Mission Hall */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Dark Missions (Locked)</span>
<<else>>
<<link '<span class="nav-card">⚔️ Mission Hall</span>' "Mission Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Spirit Pavilion */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Spirit Pavilion (Locked)</span>
<<else>>
<<link '<span class="nav-card">✨ Spirit Pavilion</span>' "Spirit Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Council Hall */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled" style="grid-column: span 2;">Ghost King's Throne (Locked)</span>
<<else>>
<<link '<span class="nav-card" style="grid-column: span 2;">🏛️ Council Hall</span>' "Council Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled" style="grid-column: span 2;">Housing (Locked)</span>
<<else>>
<<link '<span class="nav-card" style="grid-column: span 2;">� Housing</span>' "Housing">><<set $pe to 0>><</link>>
<</if>>
</div>
<<DisplayNPCS "sect" "Ghost King Netherworld Sect">>
<</nobr>><<if $pe eq 0>>
<<set $returnpassage to passage()>>
<<if $recommendationLetter eq "evil">>
Variant 1: Player has a recommendation letter
You stand at the entrance of the Ghost King Netherworld Sect, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You take a deep breath, clutching the sealed recommendation letter you received earlier. The sect’s disciple eyes the letter, and a respectful nod follows.
“I see you’ve been vouched for. The Pavilion welcomes you.”
With that, he gestures toward the main building, allowing you to pass.
You have been accepted into the sect, your future now intertwined with the Ghost King Netherworld Sect.
You may now begin your training and cultivate under their guidance.
<<link "Continue" "GhostKingNetherworldSect">>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Ghost King Netherworld Sect">>
<<set $CurrentPcMainSect to "Ghost King Sect">>
<<set $CurrentPcSect to "demonic">>
<</link>>
<<else>>
You stand at the entrance of the Ghost King Netherworld Sect, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You approach the entrance, heart racing with excitement at the thought of joining such a prestigious sect. A disciple standing guard raises an eyebrow, looking you over.
“Do you have a recommendation letter from a sect member or higher authority?” Without one, I’m afraid we cannot allow entry into the sect at this time. The path to true cultivation requires both merit and connections. However you may try to enter through duel trial. You'll face one of the sect initiates. If you manage to win, you'll be accepted”
With no recommendation in hand, you feel your chances slipping away. However, the sect is vast, and there may still be a way for you to prove yourself. The choice is yours—find another way to gain favor or try your luck elsewhere.
[[Try another time..->GhostKingNetherworldSect][$pe=0]]
[[Try through duels!->GhostKingNetherworldSectJoiningScene][$pe=2]]
<</if>>
<<elseif $pe eq 2>>
<<CreateNPC_Region1>>
You stand at the middle of stage, people are watching you.
You'll face _fullname
You can gauge their strength by observing their stance and aura. He is at _realm.
<<BeforeBattle>>
<<set $currentEnemy.sectNPC to "Ghost King Netherworld Sect">>
<<link "Attack" "SectEntranceBattle1">><<set $pe to 0>>
<<set $passage to "SectEntranceBattle1">>
<</link>>
<<elseif $pe eq 3>>
<<if $health lte 0>>
Your legs give out as the final blow lands. The stage spins, and everything fades to white.
<<= $currentEnemy.fullname>> stands tall, their breathing calm but sharp.
"You fought bravely... but you lack experience. Train harder, and perhaps fate will smile upon you next time."
The disciples around the stage whisper, some nodding in respect, others looking unimpressed.
<<link "Leave in shame!" "Map|Region1">><<set $pe to 0>><</link>>
<<elseif $currentEnemy.NPCcurrenthealth lte 0>>
With one final strike, your opponent stumbles backward, collapsing to the stage.
A hush falls over the crowd.
<<= $currentEnemy.fullname>> grits their teeth. "You... you are strong. The elders were right to test you."
An elder descends from the pavilion steps, his long white beard fluttering in the breeze.
"You have proven your determination and strength through battle. The Ghost King Netherworld Sect welcomes you."
<<link "Continue" "GhostKingNetherworldSect">>
<<set $pe = 0>>
<<set $CurrentPcSect to "demonic">>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Ghost King Netherworld Sect">>
<<set $CurrentPcMainSect to "Ghost King Sect">>
<</link>>
<</if>>
<</if>><<if $pe eq 0>>
You are fighting $currentEnemy.fullname !
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<b>General Actions</b>:
<<link "Attack" "SectEntranceBattle1">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<table class="abilities-table">\
<td>\
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )\
<<capture _i>>\
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "SectEntranceBattle1">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>\
<</if>>
<</for>>\
</td>\
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction = "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<<if $enemyaction eq "attack">>The $currentEnemy.fullname attacks you!
<<EnemyAttackAttempt>>
<<if $enemyaction = "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<<Ability $ability>><</Ability>><</if>>
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "The enemy is defeated! Victory!" $returnpassage>><<set $pe = 3>><</link>>
<<elseif $health lte 0>>
<<link "You've lost" $returnpassage>><<set $pe to 3>><</link>><
<<else>>
<<link "Continue battle" $passage>><<set $pe = 0>><</link>>
<</if>>
<</if>><<set $sectItems to []>><div class="inn-scene nsfw">
<<set _awarenessRoll to random(1, 100)>>
<<set _visitorRoll to random(1, 100)>>
<<if _awarenessRoll gte 55>>
<<set $sleepState to "awake">>
<p class="dialogue">A heavy weight shifts on the mattress. Something hot and solid presses against your thigh. Your eyes snap open, mind still swimming in drowsiness.</p>
<<include InnEvent_NSFW_Awake>>
<<else>>
<<set $sleepState to "asleep">>
<p class="dialogue">Your dreams are black and empty. You never feel the blanket being pulled away, nor the calloused hand that slides under your clothes.</p>
<<include InnEvent_NSFW_Asleep>>
<</if>>
</div><<set _visitorRoll to random(1, 100)>>
/* The intruder is already in bed, exploiting your unconsciousness */
<<if _visitorRoll lte 25>>
/* VARIANT 1: Groping over clothes - teasing touch */
<img src="images/Sex/innSleep.webp" class="nsfw-glow">
<p>Rough hands roam your body with deliberate slowness, mapping you through your sleeping clothes. He traces the curve of your breast, squeezing with possessive firmness. His calloused fingers find your nipple and pinch—not hard enough to hurt, but hard enough to make you gasp in your sleep.</p>
<p>A low, predatory chuckle rumbles from his chest. <span class="male">"Even unconscious, you respond to me."</span></p>
<p>His hand slides down your stomach, pressing flat against your belly before slipping beneath your waistband. He doesn't penetrate you yet—just cups your sex through your underwear, feeling the heat radiating from you. The pressure is firm, demanding, claiming.</p>
<p>You whimper softly, your hips twitching toward his touch. Your body seeks him out even in sleep, betraying you. He grinds his palm against your mound in slow circles, feeling your wetness begin to seep through the fabric.</p>
<p><span class="male">"Already soaked,"</span> he murmurs. <span class="male">"Your cunt's getting wet for me. Your body knows what it wants."</span></p>
<p>He continues until you're squirming beneath his hand, until your breathing becomes ragged and your hips are grinding back against his touch. Just as you're teetering on the edge of climax, he withdraws completely. You're left empty, aching, still half-asleep and thoroughly aroused.</p>
<p>He tucks himself away, taking a moment to admire his handiwork—your flushed skin, your parted lips, the wet spot soaking through your underwear—before slipping back out into the night.</p>
<p><em>The morning comes with confusion and an unfamiliar ache between your thighs.</em></p>
<<link "Wake up to sticky underwear" "InnEvent_NSFW_Morning">>
<<set $pe to 0>>
<<if $corruption lte 20>>
<<set $corruption to ($corruption or 0) + 1>>
<</if>>
<<restEffect>>
<</link>>
<<elseif _visitorRoll lte 50>>
/* VARIANT 2: Finger penetration while sleeping */
<img src="images/Sex/innFingering.webp" class="nsfw-glow">
<p>Your thighs are nudged apart with casual dominance. He yanks your underwear to the side—no patience, no ceremony. The cool night air hits your exposed sex before his thick, calloused fingers replace it, sliding between your slick folds.</p>
<p>You're already wet. Your body has prepared itself for him without your conscious consent.</p>
<p><span class="male">"Fuck, look at this wet pussy,"</span> he growls, satisfaction dripping from every word. <span class="male">"Dreaming about my cock, aren't you?"</span></p>
<p>A single finger traces your entrance, feeling the way your muscles tighten involuntarily. Then two fingers push inside, stretching you open. He pumps them in and out—deep, slow strokes—while his thumb rubs your clit in firm circles.</p>
<p>Your hips buck in your sleep, grinding down on his hand. Soft moans escape your throat as he works you with deliberate precision, building the tension inside you. Your wetness increases, coating his hand, dripping down to soak the sheets.</p>
<p><span class="male">"That's it. Take my fingers. Feel how deep they go."</span></p>
<p>He adds a third finger, stretching you further, and your back arches involuntarily. He fucks you with his hand, long strokes that pull almost completely out before driving back in, building you higher and higher toward climax. Just when you're about to come, right on the edge, he rips his hand away completely. The sudden emptiness jolts you briefly toward waking, but sleep pulls you back under before consciousness can claim you.</p>
<p>He brings his dripping fingers to his mouth and sucks them clean, groaning at the taste.</p>
<p><span class="male">"Mmm. Perfect. I'm coming back every night to fuck this cunt."</span></p>
<p><em>You wake feeling wrecked, sticky between your legs, sore in places you can't explain.</em></p>
<<link "Jolt awake confused" "InnEvent_NSFW_Morning">>
<<set $pe to 0>>
<<if $corruption lte 25>>
<<set $corruption to ($corruption or 0) + 2>>
<</if>>
<<set $energy to ($energy or 100) - 3>>
<<restEffect>>
<</link>>
<<elseif _visitorRoll lte 75>>
/* VARIANT 3: Oral sex while unconscious */
<img src="images/Sex/innCunlingus.webp" class="nsfw-glow">
<p>Your clothes are torn away with impatient hands. He spreads your legs wide and settles between them, and then his mouth is on your sex—hot, wet, aggressive. His tongue flicks across your clit hard while his hands grip your thighs, leaving bruises.</p>
<p>A gasp tears from your throat. Your hands claw at the sheets, but you never fully wake. You're trapped between dream and reality, aware only of the intense sensation of a mouth on your most sensitive flesh.</p>
<p>He eats your pussy with hunger, groaning like a starving man. His tongue pumps in and out of you, exploring you. When you try to close your thighs, he forces them apart again, pinning you, refusing to let you escape his mouth.</p>
<p><span class="male">"Don't fucking run from it. Stay open for me."</span></p>
<p>He brings you to orgasm with his tongue and lips, not stopping as you climax. Your body convulses, your back arching off the bed as pleasure crashes through you. You come hard, soaking his face, and he drinks it down like it's all he needs.</p>
<p>When you finally go completely limp, he sits up, licking his lips and chin, admiring how wet your thighs are, how slick his face is with you.</p>
<p><span class="male">"Delicious. I could eat this pussy all night."</span></p>
<p>But eventually, he leaves—slipping back out into the darkness, leaving you sprawled naked on the bed, completely used.</p>
<p><em>You wake with the ghost of a tongue on you and an ache you can't explain.</em></p>
<<link "Wake up flushed and confused" "InnEvent_NSFW_Morning">>
<<set $pe to 0>>
<<if $corruption lte 25>>
<<set $corruption to ($corruption or 0) + 2>>
<</if>>
<<set $energy to ($energy or 100) - 2>>
<<restEffect>>
<</link>>
<<elseif _visitorRoll lte 88>>
/* VARIANT 4: Masturbation and rutting - his pleasure, not yours */
<img src="images/Sex/innMasturbation.webp" class="nsfw-glow">
<p>He doesn't waste time with foreplay. His need is too urgent. His clothes are shrugged off and his cock springs free—already hard and leaking. He settles on top of you, straddling your hips, and wraps his hand around his shaft.</p>
<p>He strokes himself against you—his cock sliding between your thighs, rubbing against your sex, coating himself in your natural lubrication. It's pure selfish pleasure. You're just a warm object to him right now, an unconscious toy for his lust.</p>
<p>He fucks his own fist, his hips thrusting up into his grip as his cock continues to rub against your mound. Your unconscious body shifts with each movement, your breasts bouncing slightly with the force of his thrusts.</p>
<p><span class="male">"Fuck, yes. So good. Your body feels so fucking good."</span></p>
<p>He reaches down and grabs your breast roughly, using it as an anchor as he chases his own climax. His breathing becomes ragged, his pace more frantic. When he comes, it's with a low animalistic groan—spilling across your belly and thighs, marking you with his seed.</p>
<p>He remains there for a moment, breathing hard, admiring the mess he's made of you. The white streaks of cum covering your skin, your exposed breasts. Then he cleans himself on your sheets and disappears into the night.</p>
<p><em>You wake sticky and confused, your skin painted with dried cum.</em></p>
<<link "Wake up covered and bewildered" "InnEvent_NSFW_Morning">>
<<set $pe to 0>>
<<if $corruption lte 25>>
<<set $corruption to ($corruption or 0) + 2>>
<</if>>
<<set $energy to ($energy or 100) - 1>>
<<restEffect>>
<</link>>
<<else>>
/* VARIANT 5: Full penetration during deep sleep */
<img src="images/Sex/innPenetrationSleep.webp" class="nsfw-glow">
<p>He doesn't waste time with anything else. Your clothes are torn aside and his massive cock is already positioning itself at your entrance. You're wet enough from your dreams, from his earlier touches, and he takes full advantage.</p>
<p>He sheathes himself inside you in one brutal thrust, burying himself completely. Your sleeping body tenses around him, your walls clenching involuntarily, and he groans like he's found heaven.</p>
<p><span class="male">"Oh fuck. That's tight. Even asleep, you're perfect."</span></p>
<p>He sets a relentless pace, fucking you with power and purpose. The bed creaks beneath you both, the headboard slamming against the wall with each aggressive thrust. Your breasts bounce and sway with the force of his movements. A dribble of drool escapes the corner of your mouth as pleasure and violation blur together.</p>
<p>He grabs your hips hard enough to bruise, using them as leverage to drive himself deeper into your pussy. His grunts and groans fill the room—the sound of a man taking what he wants.</p>
<p><span class="male">"Such a perfect cunt. I could fuck this all night. Maybe I will. Maybe I'll come back every night and fill you with my cock."</span></p>
<p>His pace becomes more erratic as he chases his own release. His hand snakes down to rub your clit, forcing an orgasm from you even as he uses you. Your sleeping body responds—your pussy clenching around him so perfectly that he can't hold back any longer.</p>
<p>He buries himself deep one final time and comes, flooding you with his cum. You feel the warmth spreading inside you, coating your walls, and even in sleep your body shivers at the sensation of being filled.</p>
<p>He stays there for a long moment, still buried inside you, breathing hard. Then he withdraws slowly, watching as his cum begins to leak out of you, mixing with your own wetness.</p>
<p>He traces a finger through the mess and brings it to his mouth, tasting you mixed with himself.</p>
<p><span class="male">"I'll be back. This pussy is mine now."</span></p>
<p><em>You never wake. The sheets beneath you are soaked with the evidence of what he did to you.</em></p>
<<set $morningEvent to "inn_creampie">>
<<link "Wake up to sticky reality" "InnEvent_NSFW_Morning">>
<<set $pe to 0>>
<<if $corruption lte 35>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Nightly Intruder">>
<</if>>
<<set $energy to ($energy or 100) - 6>>
<<restEffect>>
<</link>>
<</if>><p>A man looms over you, features lost in shadow. Broad, muscular, reeking of sweat and something raw. One of his hands is already inside your pants, fingers curled around your most private flesh, stroking slowly.</p>
<img src="images/Sex/innCaughtHim.webp" class="nsfw-glow">
<p><span class="male">"You've been driving me crazy for days,"</span> he growls, his voice rough as gravel. <span class="male">"The way you move. The strength in you. I've been watching you. Had to have you."</span></p>
<p>His fingers continue their work, stroking your hardening length or rubbing your slick folds. Either way, your body betrays you, responding to his touch despite your shock.</p>
<br>
<<link "Pretend you're still asleep and don't resist" "InnEvent_NSFW_FakeSleep">>
<<set $awakeChoice to "fake_sleep">>
<</link>>
<br>
<<link "Grab his wrist and fight back" "InnEvent_NSFW_Resist">>
<<set _resistRoll to random(1, 100)>>
<<set $awakeChoice to "resist">>
<</link>>
<br>
<<if $corruption gte 30>><<link "Surrender immediately—let him take you" "InnEvent_NSFW_Willing">>
<<set $awakeChoice to "surrender">>
<</link>><</if>><img src="images/Sex/innResist.webp" class="nsfw-glow">
<<if _resistRoll gte 45>>
<p>You snarl and snatch his wrist, your reflexes sharper than expected. The man hisses in surprise as you throw him off balance. His grip loosens for just a moment—long enough for you to shove him away and roll out of bed.</p>
<p><span class="male">"Feisty,"</span> he breathes, and there's something almost admiring in his tone. <span class="male">"I fucking love that."</span></p>
<p>He reaches for you again, but you grab your blade, pressing it against his throat. His eyes—glowing faintly red in the darkness—meet yours, and for a moment the world holds its breath.</p>
<p><span class="male">"Smart,"</span> he says, and despite the weapon, he's smiling. <span class="male">"But this isn't over. I always get what I want."</span></p>
<p>He backs toward the window slowly, never taking his eyes off you. Before he disappears into the night, he drags a finger down the wall, leaving a glowing trail of his essence.</p>
<p><span class="male">"Next time, you won't have a weapon in hand. And I'll have you begging for my cock."</span></p>
<<set $pe to 0>>
<<if $corruption lte 20>>
<<set $corruption to ($corruption or 0) + 1>>
<</if>>
<<restEffect>>
<p><<link "Go back to sleep, shaken" "InnEvent_NSFW_Morning">><</link>></p>
<<else>>
<p>Your attempt is futile. He catches your wrist easily, his strength overwhelming. In one smooth motion, he twists your arm behind your back and forces you face-first into the mattress. Your blade clatters to the floor, forgotten.</p>
<p><span class="male">"I like when you fight,"</span> he snarls, his weight pressing you down completely. <span class="male">"Makes your cunt grip me tighter."</span></p>
<p>You're pinned completely, unable to move, unable to escape what comes next.</p>
<<set $morningEvent to "inn_creampie">>
<<goto "InnEvent_NSFW_Overpowered">>
<</if>><img src="images/Sex/innFakeSleep.webp" class="nsfw-glow">
<p>You force your breathing to remain steady, closing your eyes. Your heart hammers in your chest, but you don't move. Don't protest. The thrill of being taken while feigning unconsciousness—of letting him believe he's violating you—sends heat flooding through your body.</p>
<p>A satisfied growl rumbles from his throat. <span class="male">"Knew it. I fucking knew you'd be into this."</span></p>
<p>His hand continues its work, growing more insistent. His other hand moves to your chest, squeezing roughly, pinching your nipple hard enough to make you gasp.</p>
<p><span class="male">"That's it. Let me hear you."</span></p>
<p>He pulls your clothes aside entirely now, exposing you completely. The night air hits your bare flesh and you feel your body respond—wetness building, arousal spreading like wildfire.</p>
<p>His fingers sink into you—two, then three—pumping hard and fast. Your fake sleep shatters as genuine pleasure overtakes you. A moan escapes, and he chuckles darkly.</p>
<p><span class="male">"That's right. You want this. You want me to fuck you like an animal."</span></p>
<<set _fakeAsleepRoll to random(1, 100)>>
<<if _fakeAsleepRoll lte 40>>
<!-- He takes his time, savoring -->
<p>He enters you slowly, deliberately, letting you feel every inch of his cock as he sinks into you. It's a long, luxurious stroke that seems to last forever. When he's fully inside, he stays there for a moment, grinding against you, letting you adjust to his size.</p>
<p><span class="male">"Fuck, you're tight. Even better than I imagined."</span></p>
<p>He begins to thrust—long, deep strokes, controlled but intense. His hand wraps around your throat—not choking, just claiming—as he fucks you with methodical precision. He's determined to make you feel every moment of it.</p>
<p>When you climax, he's right there with you, feeling your pussy clench around his cock, and it pushes him over the edge. He comes with a low groan, burying himself deep as he floods you with his cum.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 2>>
<</if>>
<<elseif _fakeAsleepRoll lte 75>>
<!-- He takes you hard, chasing his own pleasure -->
<p>He doesn't give you time to adjust. He slams into you, setting a punishing pace from the start. The bed rocks beneath you, the headboard slamming against the wall. Your body bounces with each thrust, completely at his mercy.</p>
<p><span class="male">"This is what you want, right? To be fucked hard? To be used?"</span></p>
<p>He grabs your hips and flips you onto your belly. From behind, he's even deeper, and when he pounds into you from this angle, you scream his name.</p>
<p>He fucks you through two orgasms before he finally comes, his thrusts turning frantic as he chases his release. When he spills inside you, it's with a sound that's almost animal.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<<else>>
<!-- He goes feral, multiple rounds -->
<p>He pounds into you like a man possessed, completely lost to instinct and hunger. His hands grip your body hard enough to leave bruises. His mouth finds your neck and bites, marking you with the ferocity of his desire.</p>
<p><span class="male">"You're mine. Every fucking part of you is mine. No one else will ever fuck you like this."</span></p>
<p>He takes you three times that night—different positions, different angles, each one leaving you more wrecked than the last. By the time he's finally satisfied, you're a trembling, soaked, utterly destroyed mess beneath him.</p>
<p>When he finally leaves, you collapse into an exhausted, dreamless sleep.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<</if>>
<<set $morningEvent to "inn_creampie">>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Nightly Intruder">>
<</if>>
<<set $pe to 0>>
<<set $energy to ($energy or 100) - 8>>
<<restEffect>>
<p><<link "Collapse in satisfied exhaustion" "InnEvent_NSFW_Morning">><</link>></p><p>You're pinned completely, your struggle only arousing him further. He tears your clothes away with brutal efficiency, his hunger overriding any concern for your comfort.</p>
<img src="images/Sex/innOverpowered.webp" class="nsfw-glow">
<p><span class="male">"I've been patient,"</span> he snarls in your ear. <span class="male">"Watching you, waiting for the right moment. Now I'm done waiting."</span></p>
<p>He positions himself and enters you with zero gentleness, burying his cock completely in one harsh thrust that forces the air from your lungs. A broken cry tears from your throat.</p>
<p><span class="male">"That's it. Let me hear you scream."</span></p>
<p>He fucks you with pure lust. Your struggles only fuel him. The bed slams against the wall repeatedly. You're nothing but a vessel for his need right now, your body claimed and used with no regard for anything but his satisfaction.</p>
<<set _overpoweredRoll to random(1, 100)>>
<<if _overpoweredRoll lte 50>>
<p>He grunts with each thrust, lost in the sensation of you. Eventually, your body betrays you—pleasure overwrites protest, and you find yourself meeting his thrusts. This realization only drives him harder.</p>
<p><span class="male">"Yes. That's right. Your body knows what it wants. It wants my cock."</span></p>
<p>When he comes, he buries himself deep, flooding you with his cum. You climax moments later, your body convulsing around him.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<<else>>
<p>He fucks you relentlessly, chasing his own pleasure without waiting for yours. His hand grabs a fistful of your hair, pulling your head back, arching your spine. The other hand grips your hip hard enough to bruise.</p>
<p><span class="male">"So beautiful when you're helpless. So fucking perfect."</span></p>
<p>He comes with a grunt, spilling deep inside you, then collapses briefly before pulling out. As he dresses, he traces a finger down your back.</p>
<p><span class="male">"I'll be back for more. You're mine now."</span></p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<</if>>
<<set $morningEvent to "inn_creampie">>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Nightly Intruder">>
<</if>>
<<set $pe to 0>>
<<set $energy to ($energy or 100) - 10>>
<<restEffect>>
<p><<link "Lie there, trembling and used" "InnEvent_NSFW_Morning">><</link>></p><p>The fight drains out of you. Fear and desire tangle together until you can't tell them apart. His hand on your sex. His massive frame looming over you. The predatory hunger radiating from him.</p>
<p>You want this. You don't know why, but you want it desperately.</p>
<p><span class="player">"Yes,"</span> you breathe, spreading your legs wider. <span class="player">"Take me. Fuck me."</span></p>
<p>He grins—dangerous and satisfied. <span class="male">"That's what I wanted to hear."</span></p>
<img src="images/Sex/innWillingly.webp" class="nsfw-glow">
<p>Without another word, he positions himself and thrusts inside you, burying his cock completely. The stretch is intense, overwhelming, perfect.</p>
<p><span class="male">"Fuck. I knew you wanted it. Your body's been calling to me since the moment you walked in."</span></p>
<p>He establishes a steady rhythm—deep, purposeful strokes. His hand finds your clit and rubs in firm circles. You're caught between the fullness inside you and the stimulation outside, building rapidly toward something explosive.</p>
<<set _willingRoll to random(1, 100)>>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Nightly Intruder">>
<</if>>
<<if _willingRoll lte 35>>
<!-- Tender but possessive -->
<p>His pace is slower than expected, almost reverent. He takes his time with you, kissing your neck, your shoulders, murmuring filthy praise against your skin.</p>
<p><span class="male">"So responsive. I'm going to ruin you for anyone else. You'll never want anyone but me inside you."</span></p>
<p>When you climax, he's right there, his own release following moments later. He stays inside you, unwilling to break the connection.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<<elseif _willingRoll lte 70>>
<!-- Hard and demanding -->
<p>He loses control quickly, his pace becoming frantic. He flips you onto your side and enters you again, his hips driving against your ass with relentless force. Raw, primal fucking—him chasing his pleasure while making sure you're right there with him.</p>
<p><span class="male">"Tell me you want it. Tell me you're mine."</span></p>
<p><span class="player">"I'm yours,"</span> you gasp, and the words are true. In this moment, you absolutely are.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<<else>>
<!-- Multiple rounds of intense fucking -->
<p>He takes you multiple times throughout the night—different positions, different angles. Each time you approach climax, he shifts, keeping you balanced on that knife's edge until he decides you can come.</p>
<p>By the time he's finally spent, you've climaxed more times than you can count. Your body is wrung out, thoroughly satisfied, completely wrecked.</p>
<<if $corruption lte 40>>
<<set $corruption to ($corruption or 0) + 3>>
<</if>>
<</if>>
<<set $morningEvent to "inn_creampie">>
<<set $virgin to false>>
<<set $pe to 0>>
<<set $energy to ($energy or 100) - 7>>
<<restEffect>>
<p><<link "Fall asleep in his arms" "InnEvent_NSFW_Morning">><</link>></p><<if $morningEvent eq "inn_creampie">>
<div class="morning-after">
<img src="images/Sex/innMorningAfter.webp" class="nsfw-glow">
<p>You wake to a damp, sticky mess between your thighs. The sheets are soaked. A thick, musky scent clings to your skin and hair—his scent mixed with yours.</p>
<p>When you sit up, something warm trails down your leg. His cum, still seeping from your sore, tender entrance, mixing with your own arousal.</p>
<p>Bruises bloom across your hips, your thighs, your neck. Bite marks bruise your shoulders and breasts. Your legs shake when you try to stand. Every movement reminds you—you've been thoroughly fucked.</p>
<<if $awakeChoice eq "resist">>
<p>The violation burns in your memory. But so does the heat that pools between your legs when you remember his dominance, the way he forced you open, the way your body responded despite your protests.</p>
<<elseif $awakeChoice eq "surrender">>
<p>You touch the marks on your skin with a strange mix of shame and pride. He claimed you completely. Fucked you like you were his to use. And some part of you—the part you don't want to admit exists—loved every second of it.</p>
<<elseif $awakeChoice eq "fake_sleep">>
<p>You can still feel the ghost of him inside you, still taste him on your lips. The memory of pretending to sleep while he fucked you is already searing itself into your mind. The fact that you got off on it, that your pussy clenched around his cock, is burned into your body's memory.</p>
<</if>>
<p>Your body aches in the best way. Your pussy is sore, tender, used. There's cum drying on your inner thighs and stomach. You should feel violated. Instead, you feel like a claim has been made.</p>
<p>The innkeeper gives you a knowing smirk as you stumble past, your gait unsteady, your body clearly ravaged. Everyone can see exactly what happened to you last night.</p>
</div>
<<else>>
<</if>>
<<set $morningEvent to null>>
<<link "Get up" $passage>><<set $pe to 0>><</link>><<widget "HuntBeastsR1">>
<<set _chance = random(0,100)>>
<<if _chance lte 20>>
<<BloodfangTiger>>
<<elseif _chance gt 20 and _chance lt 40>>
<<IronclawBear>>
<<else>>
<<ScarletEagle>>
<</if>>
<</widget>>
<<widget "BloodfangTiger">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Bloodfang Tiger">>
<<set _fullname = "Bloodfang Tiger">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random (20,40)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Bloodfang Tiger, its crimson fur slick with dried blood. It growls lowly, its fangs pulsing with an ominous qi, thirsting for another soul.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP
}>>
<</silently>>\
<</widget>>\
<<widget "IronclawBear">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Ironclaw Bear">>
<<set _fullname = "Ironclaw Bear">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEXP = random (20,40)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Ironclaw Bear, a hulking beast with claws like sabers. The earth trembles with each of its heavy, deliberate steps.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyXP: _enemyEXP,
enemyDesc: _description
}>>
<</silently>>\
<</widget>>\
<<widget "ScarletEagle">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Scarlet Eagle">>
<<set _fullname = "Scarlet Eagle">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEXP = random (20,40)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Scarlet Eagle, circling above. Its cry echoes sharply across the valley as it dives with blinding speed.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyXP: _enemyEXP,
enemyDesc: _description
}>>
<</silently>>\
<</widget>>\
<<widget "WhisperingShade">>
<<silently>>
<<set _enemyability = []>>
<<set _enemyability.push("attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Whispering Shade">>
<<set _fullname = "Whispering Shade">>
<<set _location = ["Bamboo Grove of Whispers", "Forgotten Burial Ground", "Moonlit Ravine"].random()>>
<<set _maxhealthNPC = random(280, 360)>>
<<set _maxenergyNPC = random(160, 220)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(2, 6)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(3, 6)>>
<<set _basewillpowerNPC = random(8, 12)>>
<<set _atkNPC = random(5, 12)>>
<<set _defNPC = random(7, 12)>>
<<set _critNPC = random(3, 6)>>
<<set _critresNPC = random(2, 5)>>
<<set _agilityNPC = random(8, 14)>>
<<set _martialArtsNPC = random(0, 1)>>
<<set _spiritualRootNPC = random(2, 4)>> <!-- Ghostly affinity -->
<<set _enemyEXP = random(35, 55)>>
<<set _enemyEvadeScore = (_agilityNPC * 2.2) + (_insightNPC * 1.8) + (_luckNPC * 0.5)>>
<<set _description = "A ghostly cultivator manifests from the shadows, its form wavering like smoke in the moonlight. Hollow eyes burn faintly as the whispers in the bamboo rise to a maddening chorus.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyXP: _enemyEXP,
enemyDesc: _description
}>>
<</silently>>
<</widget>>
<<widget "ShadowtailBeast">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Shadowtail Beast">>
<<set _fullname = "Shadowtail Beast">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random (20,40)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Shadowtail Beast, its sleek dark fur glistening with a faint glow. It growls lowly, its eyes glowing violet.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP
}>>
<</silently>>\
<</widget>>\
<<widget "ScaredMerchants">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Panicked_band_of_merchants">>
<<set _fullname = "Panicked band of merchants">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(240, 250)>>
<<set _maxenergyNPC = random(100, 130)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(5, 6)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(4, 10)>>
<<set _defNPC = random(3, 6)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random (20,40)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see a band of merchants, their faces grim and eyes alert. They carry heavy packs and weapons, clearly not here for leisure.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP
}>>
<</silently>>\
<</widget>>\/*
HerbGather Widget
─────────────────
Usage: <<HerbGather>>
Must be called from inside a region passage that has already set $region.
Expects:
$region — string matching one of the three region names
Item pools are defined per region. Each entry: [itemVariable, itemName, rarity]
rarity: "common" → qty 2–5, "uncommon" → qty 1–3, "rare" → qty 1–2
Random events (per gather attempt):
70% nothing (just gather)
12% beast ambush → placeholder combat hook
8% wandering stranger → cultivator / merchant / sect disciple (random)
7% fox woman encounter → spirit fox spirit, NSFW gated by $corruption
3% rival cultivator → hostile NPC who may fight or leave
NSFW options gated:
$corruption >= 20 → mild flirtatious options visible
$corruption >= 50 → explicit options visible
*/
<<widget "HerbGather">>
/* ── Build region item pool ── */
<<set _pool to []>>
<<if $region is "Blood Sand Reach">>
/* Desert / arid zone — yang-aspected, beast-heavy, harsh */
<<set _pool to [
$burningsandresin,
$sturdygrassfiber,
$duskbloodmoss,
$solarstonepowder,
$bloodhardeningherb,
$thunderweed,
$crimsonhideflake,
$ironbloodlotusseed,
$vitalityroot,
$heartdevilweed
]>>
<<elseif $region is "Hundred Sorrows Mountain">>
/* High altitude — yin-aspected, cold qi, rare meridian herbs */
<<set _pool to [
$stonepulsepebble,
$risingmistherb,
$clearwaterextract,
$emptymindherb,
$moonlightshell,
$serpentpulsesalve,
$cinnabarheartstone,
$stillwaterpearlpowder,
$nineleaflotus,
$moonlitjadefragment,
$agelesspinetwig
]>>
<<elseif $region is "Great Plains">>
/* Open flatlands — balanced qi, common cultivation materials */
<<set _pool to [
$spiritvinetendril,
$qispunsilk,
$lessermeridiandust,
$swiftwindfeather,
$shadowstepmoss,
$rosedewhoney,
$faintqicrystal,
$greenspiritsap,
$breathingmoonmoss,
$fortunemistseed,
$bloodlotuspetal
]>>
<</if>>
/* ── Roll item ── */
<<set _pick to _pool[random(0, _pool.length - 1)]>>
<<set _rarity to _pick.rarity>>
<<if _rarity is "common">>
<<set _qty to random(2, 5)>>
<<elseif _rarity is "uncommon">>
<<set _qty to random(1, 3)>>
<<else>>
<<set _qty to random(1, 2)>>
<</if>>
/* ── Add to inventory using the loop and clone method ── */
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j < $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].id === _pick.id>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
/* Item exists, add the rolled quantity */
<<set $playeriteminventory[_index].quantity += _qty>>
<<else>>
/* Item does not exist, clone the template and set quantity */
<<set _newItem to clone(_pick)>>
<<set _newItem.quantity to _qty>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
/* ── Roll event (0–99) ── */
<<set _eventRoll to random(0, 99)>>
<<if _eventRoll lt 70>>
/* ════════════════════════════════
EVENT: Peaceful gather (70%)
════════════════════════════════ */
<<set _flavorPeaceful to [
"The wind stirs the grass around you. Nothing moves but the rustling of leaves.",
"Birdsong fills the air. A good day to gather.",
"You work in silence, hands moving with practiced efficiency.",
"The qi here is thin but steady. You breathe slowly and gather.",
"Clouds drift overhead. No trouble today.",
"A faint spiritual pressure hums beneath the soil — a sign of good herbs.",
"The earth here feels undisturbed. You make the most of it.",
"You lose yourself in the rhythm of searching and plucking.",
"A gentle mist rolls through. You gather undisturbed.",
"Something small skitters away through the grass as you approach. Nothing dangerous."
]>>
<p class="herb-gather-flavor"><<= _flavorPeaceful[random(0, _flavorPeaceful.length - 1)]>></p>
<<elseif _eventRoll lt 82>>
/* ════════════════════════════════
EVENT: Beast ambush (12%)
════════════════════════════════ */
<<set _beastFlavor to [
"The silence shatters. Something lunges from the brush — claws already drawn.",
"You catch the scent of blood a moment too late. A beast crashes through the undergrowth.",
"A guttural growl erupts from the shadows ahead. Your hand moves to your weapon.",
"The air goes cold. You spin to find red eyes watching you from the treeline.",
"Pebbles skitter across stone behind you. An ambush — well laid, poorly timed."
]>>
<p class="herb-gather-flavor"><<= _beastFlavor[random(0, _beastFlavor.length - 1)]>></p>
<p class="herb-gather-event-label">⚔ A beast emerges!</p>
<<BeastsPickFight>>
<<set $combatReturnPassage to passage()>>
<<link "Battle" "HuntBeastsBattle|Region1">><<set $passage to "HuntBeastsBattle|Region1">><<BeforeBattle>><<set $pe=0>><</link>>
<<elseif _eventRoll lt 90>>
/* ════════════════════════════════
EVENT: Wandering stranger (8%)
════════════════════════════════ */
<<set _strangerType to random(0, 2)>>
<<if _strangerType is 0>>
/* Wandering cultivator */
<<set _cultivatorMood to random(0, 1)>>
<p class="herb-gather-flavor">A figure drops from the treetops without a sound — robes dusty from travel, a gourd of spirit wine at their hip. Their eyes sweep over you with the calm assessment of someone who has survived many dangerous places.</p>
<<if _cultivatorMood is 0>>
<p class="herb-gather-flavor">"Gathering alone out here?" they say, glancing at your haul. "Brave or stupid. With a face like that, I'll assume brave." They pause, then toss something small in your direction before vanishing into the treeline.</p>
<<set $meditationdust.quantity += 1>>
<p class="herb-gather-event-label">✦ The cultivator left behind: Meditation Dust ×1</p>
<<link "..." $loopPassage>><</link>>
<<else>>
<p class="herb-gather-flavor">"This area falls under the Iron Cloud Sect's outer patrol route," the cultivator says flatly. "I'd suggest you finish quickly." They do not wait for your response before leaping away.</p>
<p class="herb-gather-event-label">⚑ You have been warned. Gather quickly.</p>
<<link "..." $loopPassage>><</link>>
<</if>>
<<elseif _strangerType is 1>>
/* Traveling merchant */
<p class="herb-gather-flavor">A hunched figure emerges from behind a boulder, laden with bundles and jars clinking softly against each other. A traveling alchemist-merchant, by the look of the herb stains on their fingers.</p>
<p class="herb-gather-flavor"><span class="male">"Ah! A cultivator with a good eye for gathering. I respect that. "</span> They squint at your collection. <span class="male">"I could take some of what you've found off your hands, if the price suits."</span></p>
<p class="herb-gather-event-label">✦ A traveling merchant appeared. They seemed harmless — and oddly well-stocked.</p>
/* TODO: optionally hook into your merchant/shop system here */
<<else>>
/* Sect disciple */
<<set _sectMood to random(0, 1)>>
<p class="herb-gather-flavor">A young cultivator in sect robes steps onto the path ahead, their bearing stiff with the self-importance of someone recently promoted to outer disciple.</p>
<<if _sectMood is 0>>
<p class="herb-gather-flavor">Their eyes land on you and widen. Something shifts — recognition, or perhaps your reputation reaching them before your name does. They mutter something about their senior brothers and hurry off without another word.</p>
<p class="herb-gather-event-label">⚑ They recognized you. Word may spread.</p>
<<link "..." $loopPassage>><</link>>
<<else>>
<p class="herb-gather-flavor"><span class="male">"You dare gather in our sect's territory?"</span> they snap, hand flying to their spirit weapon. Then they seem to reconsider. Their gaze moves over you slowly, and the anger flickers into something more complicated. <span class="male">"...I'll let it go. This once."</span></p>
<p class="herb-gather-event-label">⚑ The disciple backed down — though not without looking you over a little too long.</p>
<<link "..." $loopPassage>><</link>>
<</if>>
<</if>>
<<elseif _eventRoll lt 97>>
/* ════════════════════════════════
EVENT: Fox woman encounter (7%)
════════════════════════════════ */
<<set _foxApproach to random(0, 2)>>
<<if _foxApproach is 0>>
<p class="herb-gather-flavor">You notice her only because she lets you — a woman perched on a low branch above the path, nine silver tails fanning behind her like smoke. Her amber eyes hold the particular amusement of someone who has watched mortals for a very long time.</p>
<p class="herb-gather-flavor">"Little cultivator," she says, voice low and unhurried. "You gather herbs in a demon's garden and don't even leave an offering. How rude."</p>
<<elseif _foxApproach is 1>>
<p class="herb-gather-flavor">The smell reaches you first — something warm and floral and faintly wrong. Then she steps from behind a tree that should not have hidden her, fox ears tilted with curiosity, tails sweeping the grass behind her.</p>
<p class="herb-gather-flavor">"You have good instincts," she says, studying your gathered herbs. "And passable taste. I'll allow your trespassing — for now."</p>
<<else>>
<p class="herb-gather-flavor">A silver fox darts across the path — then shimmers, stretches upward, and becomes a woman with nine tails and an expression of profound boredom. She looks you over without hurry.</p>
<p class="herb-gather-flavor">"A cultivator, all alone." She tilts her head. "Lost, or just foolish?"</p>
<</if>>
<div id="herb-fox-interaction" class="herb-gather-choices">
<<link "Greet her respectfully">>
<<replace "#herb-fox-interaction">>
<p class="herb-gather-flavor">You press your palms together and bow. "This one did not know the land belonged to you, senior. I apologize for the intrusion."</p>
<p class="herb-gather-flavor">She blinks — surprised, perhaps, by the absence of fear. Then she smiles slowly. "Manners. A rare thing." She descends from the branch and circles you once before vanishing in a shimmer of silver. A small token drops from the air where she stood.</p>
<<set $jadegatheringthread.quantity += 1>>
<p class="herb-gather-event-label">✦ She left behind: Jade Gathering Thread ×1</p>
<br>
<<link "..." $loopPassage>><</link>>
<</replace>>
<</link>>
<br>
<<link "Hold your ground and show no weakness">>
<<replace "#herb-fox-interaction">>
<p class="herb-gather-flavor">You meet her amber gaze and don't look away. "I gathered what I came for. I'll leave when I choose."</p>
<p class="herb-gather-flavor">A long pause. Then she laughs — genuine and delighted. "Oh, I like you." She snaps her fingers and a small flame flares between them before guttering out. "Don't make me regret it." She dissolves into the treeline like morning fog.</p>
<p class="herb-gather-event-label">⚑ She seemed amused. You sense you may meet her again.</p>
<br>
<<link "..." $loopPassage>><</link>>
<</replace>>
<</link>>
<br>
<<if $corruption gte 20>>
<<link "Hold her gaze and smile slowly">>
<<replace "#herb-fox-interaction">>
<p class="herb-gather-flavor">You let the silence stretch, then smile. "A demon's garden," you repeat. "Then perhaps I should have brought an offering after all. What would you accept?"</p>
<p class="herb-gather-flavor">Her tails curl. She steps closer — close enough that the warmth radiating off her is unmistakable. "Careful," she murmurs. "You're either very brave or very foolish. I find myself hoping for the latter." She tucks a single silver hair behind your ear and vanishes.</p>
<<set $shadowlustpollen.quantity += 1>>
<p class="herb-gather-event-label">✦ She left something behind: Shadow Lust Pollen ×1</p>
<br>
<<link "..." $loopPassage>><</link>>
<</replace>>
<</link>>
<br>
<</if>>
<<if $corruption gte 50>>
<<link "Step closer — let her see you're not afraid of what she is">>
<<replace "#herb-fox-interaction">>
<p class="herb-gather-flavor">You close the distance slowly, deliberately, watching her ears flick forward in surprise. "I know what you are," you say quietly. "And I'm still here."</p>
<p class="herb-gather-flavor">Something shifts behind her amber eyes. She reaches out and traces one claw lightly along your jaw — not a threat. A test. You don't flinch. She makes a sound low in her throat and steps back, tails curling tight.</p>
<p class="herb-gather-flavor">"Come back tomorrow," she says. "Bring better herbs." She disappears between one blink and the next, leaving only warmth and the scent of silver fox magic on the air.</p>
<<set $foxWomanMet to true>>
<p class="herb-gather-event-label">✦ She issued an invitation. Whether you return is your choice.</p>
/* TODO: optional flag to trigger a follow-up fox woman scene on next visit */
<br>
<<link "..." $loopPassage>><</link>>
<</replace>>
<</link>>
<br>
<</if>>
</div>
<<else>>
/* ════════════════════════════════
EVENT: Rival cultivator (3%)
════════════════════════════════ */
<<set _rivalMood to random(0, 2)>>
<<if _rivalMood is 0>>
/* Hostile — demands herbs */
<p class="herb-gather-flavor">The qi pressure arrives before the person — a concentrated hostility that makes the herbs around you wilt slightly. A cultivator drops from the sky, sword drawn, eyes fixed on your gathered materials.</p>
<p class="herb-gather-flavor">"Hand over the herbs. I have no quarrel with you beyond this."</p>
<p class="herb-gather-event-label">⚔ A rival cultivator demands your gathered herbs!</p>
<div class="herb-gather-choices">
<<link "Refuse and fight">>
<<replace "#herb-rival-response">>
<p class="herb-gather-flavor">You tighten your grip on what you've gathered. "Come take them."</p>
<p class="herb-gather-event-label">⚔ Combat begins!</p>
<<set $combatReturnPassage to passage()>>
<p class="herb-gather-placeholder">[Combat trigger goes here]</p>
<</replace>>
<</link>>
<br>
<<link "Surrender half your herbs to avoid conflict">>
<<replace "#herb-rival-response">>
<p class="herb-gather-flavor">You toss a portion of your haul at their feet. They snatch it up without thanks and vanish. A bitter trade — but not a fatal one.</p>
<<set $[_pick.id].quantity -= Math.floor(_qty / 2)>>
<p class="herb-gather-event-label">⚑ You lost half your gathered herbs.</p>
<</replace>>
<</link>>
<br>
<<link "Use your reputation to intimidate them">>
<<replace "#herb-rival-response">>
<p class="herb-gather-flavor">You let your qi unfurl — just enough. Your name, your sect, your record. You watch the calculation cross their face. A moment later they sheathe their sword and leave without a word.</p>
<p class="herb-gather-event-label">✦ They backed down. Reputation has its uses.</p>
<</replace>>
<</link>>
</div>
<span id="herb-rival-response"></span>
<<elseif _rivalMood is 1>>
/* Wounded — needs help */
<p class="herb-gather-flavor">A cultivator emerges from the mist, wounded — one arm pressed to their side. They freeze when they see you, then relax fractionally. "You're not one of theirs," they say. It is not a question.</p>
<p class="herb-gather-flavor">They need medical herbs. By coincidence or fate, you have some.</p>
<div class="herb-gather-choices">
<<link "Give them what they need">>
<<replace "#herb-rival-response">>
<p class="herb-gather-flavor">You hand over a portion of your gathering without ceremony. They stare at you for a moment, then nod — the deep kind, the kind that means something. "I won't forget this." They slip back into the mist.</p>
<<set $greenspiritsap.quantity -= 1>>
<p class="herb-gather-event-label">✦ You gave aid. A debt was acknowledged.</p>
/* TODO: optional — set a relationship flag with this NPC */
<</replace>>
<</link>>
<br>
<<link "Demand payment in exchange">>
<<replace "#herb-rival-response">>
<p class="herb-gather-flavor">"Nothing is free," you say. They grimace — then reach into their robes and produce a spirit stone. "Fine." You make the exchange. They disappear without looking back.</p>
<<set $greenspiritsap.quantity -= 1>>
<<set $gold += 30>>
<p class="herb-gather-event-label">✦ You traded herbs for 30 spirit stones.</p>
<</replace>>
<</link>>
<br>
<<link "Leave them to their fate">>
<<replace "#herb-rival-response">>
<p class="herb-gather-flavor">Their problem. You've enough of your own. You pocket your herbs and move on without a word. Behind you, you hear them slide down against rock to rest. They'll live or they won't.</p>
<p class="herb-gather-event-label">⚑ You walked away.</p>
<</replace>>
<</link>>
</div>
<span id="herb-rival-response"></span>
<<else>>
/* Fleeing something worse */
<p class="herb-gather-flavor">You hear them before you see them — a cultivator sprinting through the undergrowth, panic written plainly across their face. They skid to a halt when they nearly collide with you.</p>
<p class="herb-gather-flavor">"Move," they gasp. "Something is following me. Something big." They don't wait — they vault over a boulder and vanish into the distance.</p>
<p class="herb-gather-flavor">A moment later, you hear it too. Heavy footsteps. Getting closer.</p>
<p class="herb-gather-event-label">⚔ Whatever they were fleeing has found you now.</p>
<<BeastsPickFight>>
<<set $combatReturnPassage to passage()>>
<<link "Battle" "HuntBeastsBattle|Region1">><<set $passage to "HuntBeastsBattle|Region1">><<BeforeBattle>><<set $pe=0>><</link>>
<</if>>
<</if>>
/* ── Always show what was gathered ── */
<hr class="herb-divider">
<p class="herb-gather-result">You gathered: <strong><<= _pick.name>> ×<<= _qty>></strong>
<<if _rarity is "rare">> <span class="herb-rarity-rare">(Rare)</span>
<<elseif _rarity is "uncommon">> <span class="herb-rarity-uncommon">(Uncommon)</span>
<</if>>
</p>
<</widget>><<BeastsPickFight>>
_description
<<link "Run away before _fullname sees you!" "Map|Region1">> <</link>>
<<link "Fall back and try to hunt different beast" "HuntBeasts|Region1">> <</link>>
<<link "Battle" "HuntBeastsBattle|Region1">><<set $passage to "HuntBeastsBattle|Region1">><<BeforeBattle>><<set $pe=0>><</link>><<widget "BeastsPickFight">>
<<if $region eq "Hundred Sorrows Mountain">>
<<set _roll = ["FrostclawBear", "MistVeilCrane", "SorrowPeakApe", "GlacialSerpentElder"].random()>>
<<if _roll eq "FrostclawBear">><<FrostclawBear>>
<<elseif _roll eq "MistVeilCrane">><<MistVeilCrane>>
<<elseif _roll eq "SorrowPeakApe">><<SorrowPeakApe>>
<<elseif _roll eq "GlacialSerpentElder">><<GlacialSerpentElder>>
<</if>>
<<elseif $region eq "Blood Sand Reach">>
<<set _roll = ["SandscorchLizard", "DuneStriderOx", "BloodSandScorpion", "YangFlameFox"].random()>>
<<if _roll eq "SandscorchLizard">><<SandscorchLizard>>
<<elseif _roll eq "DuneStriderOx">><<DuneStriderOx>>
<<elseif _roll eq "BloodSandScorpion">><<BloodSandScorpion>>
<<elseif _roll eq "YangFlameFox">><<YangFlameFox>>
<</if>>
<<elseif $region eq "Great Plains">>
<<set _roll = ["WindhareSpirit", "PlainsStoneback", "GrasswhipSerpent", "MudwolfPack"].random()>>
<<if _roll eq "WindhareSpirit">><<WindhareSpirit>>
<<elseif _roll eq "PlainsStoneback">><<PlainsStoneback>>
<<elseif _roll eq "GrasswhipSerpent">><<GrasswhipSerpent>>
<<elseif _roll eq "MudwolfPack">><<MudwolfPack>>
<</if>>
<<endif>>
<</widget>>
/* ══════════════════════════════════════════════════════
GREAT PLAINS BEASTS — Weak to Medium (early game)
══════════════════════════════════════════════════════ */
<<widget "WindhareSpirit">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "evade")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Windhare Spirit">>
<<set _fullname = "Windhare Spirit">>
<<set _location = "Great Plains">>
<<set _maxhealthNPC = random(80, 130)>>
<<set _maxenergyNPC = random(40, 60)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(4, 8)>>
<<set _insightNPC = random(3, 6)>>
<<set _basestrengthNPC = random(2, 4)>>
<<set _basewillpowerNPC = random(1, 3)>>
<<set _atkNPC = random(3, 7)>>
<<set _defNPC = random(1, 4)>>
<<set _critNPC = random(1, 3)>>
<<set _critresNPC = random(0, 1)>>
<<set _agilityNPC = random(10, 16)>>
<<set _martialArtsNPC = random(0, 1)>>
<<set _enemyEXP = random(155, 222)>>
<<set _spiritualRootNPC = random(0, 2)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $swiftwindfeather, chance: 60},
{item: $risingmistherb, chance: 40},
{item: $lessermeridiandust, chance: 25}
]>>
<<set _description = "A hare the size of a dog, its fur rippling with visible wind currents. It watches you with unnervingly keen eyes before darting sideways — faster than something this small has any right to be.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "PlainsStoneback">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "defend")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Plains Stoneback">>
<<set _fullname = "Plains Stoneback">>
<<set _location = "Great Plains">>
<<set _maxhealthNPC = random(160, 220)>>
<<set _maxenergyNPC = random(50, 80)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 3)>>
<<set _insightNPC = random(1, 3)>>
<<set _basestrengthNPC = random(5, 8)>>
<<set _basewillpowerNPC = random(2, 4)>>
<<set _atkNPC = random(5, 10)>>
<<set _defNPC = random(8, 14)>>
<<set _critNPC = random(1, 2)>>
<<set _critresNPC = random(1, 3)>>
<<set _agilityNPC = random(2, 5)>>
<<set _martialArtsNPC = random(0, 1)>>
<<set _enemyEXP = random(190, 240)>>
<<set _spiritualRootNPC = random(0, 1)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $sturdygrassfiber, chance: 65},
{item: $temperedbonefragment, chance: 45},
{item: $beastsinewfiber, chance: 30}
]>>
<<set _description = "A heavy tortoise-like beast with a shell of compressed earth and stone. It moves slowly and without fear — the kind of creature that has never needed to run from anything.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "GrasswhipSerpent">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "evade")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Grasswhip Serpent">>
<<set _fullname = "Grasswhip Serpent">>
<<set _location = "Great Plains">>
<<set _maxhealthNPC = random(120, 170)>>
<<set _maxenergyNPC = random(60, 90)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(2, 5)>>
<<set _insightNPC = random(3, 6)>>
<<set _basestrengthNPC = random(4, 7)>>
<<set _basewillpowerNPC = random(2, 4)>>
<<set _atkNPC = random(7, 13)>>
<<set _defNPC = random(3, 7)>>
<<set _critNPC = random(2, 5)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(7, 12)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random(222, 266)>>
<<set _spiritualRootNPC = random(0, 2)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $serpentpulsesalve, chance: 55},
{item: $serpentmarkscale, chance: 30},
{item: $windveinpowder, chance: 20}
]>>
<<set _description = "A long serpent that blends perfectly into the tall grass, visible only as a ripple of displaced air. It strikes with the crack of a whip — twice before you've registered the first blow.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "MudwolfPack">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Mudwolf Pack">>
<<set _fullname = "Mudwolf Pack">>
<<set _location = "Great Plains">>
<<set _maxhealthNPC = random(200, 270)>>
<<set _maxenergyNPC = random(70, 100)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(2, 5)>>
<<set _insightNPC = random(4, 7)>>
<<set _basestrengthNPC = random(5, 9)>>
<<set _basewillpowerNPC = random(3, 5)>>
<<set _atkNPC = random(9, 16)>>
<<set _defNPC = random(4, 8)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 10)>>
<<set _martialArtsNPC = random(1, 3)>>
<<set _enemyEXP = random(280, 300)>>
<<set _spiritualRootNPC = random(0, 2)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $beastsinewfiber, chance: 60},
{item: $bloodhardeningherb, chance: 35},
{item: $flowrootessence, chance: 20}
]>>
<<set _description = "Three mudwolves circle you without sound, their coats matted with dried earth that hardens their flanks like crude armor. They don't rush. They wait for the gap.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
BLOOD SAND REACH BEASTS — Medium (early-mid game)
══════════════════════════════════════════════════════ */
<<widget "SandscorchLizard">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "defend")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Sandscorch Lizard">>
<<set _fullname = "Sandscorch Lizard">>
<<set _location = "Blood Sand Reach">>
<<set _maxhealthNPC = random(180, 250)>>
<<set _maxenergyNPC = random(70, 110)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 4)>>
<<set _insightNPC = random(2, 5)>>
<<set _basestrengthNPC = random(6, 9)>>
<<set _basewillpowerNPC = random(2, 5)>>
<<set _atkNPC = random(10, 18)>>
<<set _defNPC = random(10, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(1, 3)>>
<<set _agilityNPC = random(4, 8)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random(180, 280)>>
<<set _spiritualRootNPC = random(0, 2)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $thunderlizardhide, chance: 55},
{item: $burningsandresin, chance: 50},
{item: $copperskinpowder, chance: 35}
]>>
<<set _description = "A broad, flat lizard whose scales have been scorched to near-ceramic hardness by years under the blood sun. Heat shimmer rises from its back. When it opens its mouth, you see embers.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "DuneStriderOx">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "attack", "defend")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Dune Strider Ox">>
<<set _fullname = "Dune Strider Ox">>
<<set _location = "Blood Sand Reach">>
<<set _maxhealthNPC = random(280, 370)>>
<<set _maxenergyNPC = random(80, 120)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 3)>>
<<set _insightNPC = random(1, 3)>>
<<set _basestrengthNPC = random(9, 13)>>
<<set _basewillpowerNPC = random(3, 6)>>
<<set _atkNPC = random(13, 22)>>
<<set _defNPC = random(11, 18)>>
<<set _critNPC = random(1, 3)>>
<<set _critresNPC = random(2, 5)>>
<<set _agilityNPC = random(3, 6)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random(250, 400)>>
<<set _spiritualRootNPC = random(0, 2)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $mountainoxtendon, chance: 50},
{item: $beastsinewfiber, chance: 55},
{item: $ironcorehusk, chance: 30},
{item: $vitalityroot, chance: 20}
]>>
<<set _description = "A massive bovine beast with iron-dense horns and hooves that crack stone with every step. Its hide is layered like overlapping plates. It has no particular interest in you — until it does.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "BloodSandScorpion">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "evade", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Blood Sand Scorpion">>
<<set _fullname = "Blood Sand Scorpion">>
<<set _location = "Blood Sand Reach">>
<<set _maxhealthNPC = random(220, 300)>>
<<set _maxenergyNPC = random(90, 130)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(2, 5)>>
<<set _insightNPC = random(3, 6)>>
<<set _basestrengthNPC = random(7, 11)>>
<<set _basewillpowerNPC = random(3, 6)>>
<<set _atkNPC = random(14, 24)>>
<<set _defNPC = random(8, 14)>>
<<set _critNPC = random(3, 6)>>
<<set _critresNPC = random(1, 3)>>
<<set _agilityNPC = random(7, 12)>>
<<set _martialArtsNPC = random(1, 3)>>
<<set _enemyEXP = random(280, 420)>>
<<set _spiritualRootNPC = random(1, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $duskbloodmoss, chance: 50},
{item: $crimsonhideflake, chance: 45},
{item: $innerflamecore, chance: 25},
{item: $ironbloodlotusseed, chance: 15}
]>>
<<set _description = "A scorpion the size of a dog, its carapace the deep red of old blood. Its stinger drips something that sizzles when it hits the sand. It moves in sudden, unpredictable bursts.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "YangFlameFox">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "evade", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Yang Flame Fox">>
<<set _fullname = "Yang Flame Fox">>
<<set _location = "Blood Sand Reach">>
<<set _maxhealthNPC = random(200, 270)>>
<<set _maxenergyNPC = random(110, 150)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(3, 6)>>
<<set _insightNPC = random(4, 7)>>
<<set _basestrengthNPC = random(6, 9)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(12, 20)>>
<<set _defNPC = random(5, 10)>>
<<set _critNPC = random(4, 7)>>
<<set _critresNPC = random(1, 3)>>
<<set _agilityNPC = random(9, 14)>>
<<set _martialArtsNPC = random(2, 4)>>
<<set _enemyEXP = random(300, 450)>>
<<set _spiritualRootNPC = random(2, 5)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $solarstonepowder, chance: 50},
{item: $innerflamecore, chance: 45},
{item: $heartdevilweed, chance: 20},
{item: $sunheartbark, chance: 20}
]>>
<<set _description = "A three-tailed fox with fur the color of ignited coal. Its paws leave scorched prints in the sand and its eyes burn a steady, patient amber. It looks like it is enjoying this.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
HUNDRED SORROWS MOUNTAIN BEASTS — Medium-Strong (mid game)
══════════════════════════════════════════════════════ */
<<widget "FrostclawBear">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "defend", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Frostclaw Bear">>
<<set _fullname = "Frostclaw Bear">>
<<set _location = "Hundred Sorrows Mountain">>
<<set _maxhealthNPC = random(300, 400)>>
<<set _maxenergyNPC = random(100, 140)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 3)>>
<<set _insightNPC = random(2, 4)>>
<<set _basestrengthNPC = random(10, 14)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(15, 26)>>
<<set _defNPC = random(13, 20)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(3, 6)>>
<<set _agilityNPC = random(3, 7)>>
<<set _martialArtsNPC = random(1, 3)>>
<<set _enemyEXP = random(305, 550)>>
<<set _spiritualRootNPC = random(1, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $goldenmarrowfragment, chance: 35},
{item: $beastsinewfiber, chance: 55},
{item: $mountainoxtendon, chance: 30},
{item: $clearwaterextract, chance: 25}
]>>
<<set _description = "A massive bear whose claws are permanently encased in a sheath of icy qi. Frost spreads from each pawfall. Its breath comes in visible plumes and it regards you with the calm of a creature that has never lost a fight on this mountain.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "MistVeilCrane">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "evade", "attack", "evade")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Mist Veil Crane">>
<<set _fullname = "Mist Veil Crane">>
<<set _location = "Hundred Sorrows Mountain">>
<<set _maxhealthNPC = random(210, 280)>>
<<set _maxenergyNPC = random(130, 180)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(4, 7)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(5, 8)>>
<<set _basewillpowerNPC = random(5, 9)>>
<<set _atkNPC = random(12, 20)>>
<<set _defNPC = random(6, 11)>>
<<set _critNPC = random(4, 7)>>
<<set _critresNPC = random(2, 4)>>
<<set _agilityNPC = random(11, 17)>>
<<set _martialArtsNPC = random(2, 5)>>
<<set _enemyEXP = random(320, 500)>>
<<set _spiritualRootNPC = random(3, 6)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $moonlightshell, chance: 45},
{item: $swiftwindfeather, chance: 50},
{item: $lightningsteptendon, chance: 20},
{item: $meditationdust, chance: 30}
]>>
<<set _description = "A white crane that stands taller than a man, its feathers perpetually wreathed in mountain mist. It does not attack clumsily — every movement is a practiced technique, precise and devastating.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "SorrowPeakApe">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "attack", "defend", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Sorrow Peak Ape">>
<<set _fullname = "Sorrow Peak Ape">>
<<set _location = "Hundred Sorrows Mountain">>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 4)>>
<<set _insightNPC = random(3, 6)>>
<<set _basestrengthNPC = random(12, 16)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(18, 30)>>
<<set _defNPC = random(12, 19)>>
<<set _critNPC = random(2, 5)>>
<<set _critresNPC = random(3, 6)>>
<<set _agilityNPC = random(5, 9)>>
<<set _martialArtsNPC = random(2, 5)>>
<<set _enemyEXP = random(240, 350)>>
<<set _spiritualRootNPC = random(1, 4)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $titanapehair, chance: 40},
{item: $goldenmarrowfragment, chance: 30},
{item: $beastsinewfiber, chance: 60},
{item: $stonepulsepebble, chance: 30}
]>>
<<set _description = "A great silver-furred ape that haunts the upper ridges of Hundred Sorrows Mountain. Its arms are longer than they should be. When it beats its chest, stones crack in the echo. Cultivators who underestimate it do not make the mistake twice.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\
<<widget "GlacialSerpentElder">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack", "evade", "attack", "defend")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Glacial Serpent Elder">>
<<set _fullname = "Glacial Serpent Elder">>
<<set _location = "Hundred Sorrows Mountain">>
<<set _maxhealthNPC = random(370, 480)>>
<<set _maxenergyNPC = random(150, 200)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(2, 5)>>
<<set _insightNPC = random(5, 9)>>
<<set _basestrengthNPC = random(10, 14)>>
<<set _basewillpowerNPC = random(6, 10)>>
<<set _atkNPC = random(17, 28)>>
<<set _defNPC = random(10, 17)>>
<<set _critNPC = random(4, 8)>>
<<set _critresNPC = random(2, 5)>>
<<set _agilityNPC = random(8, 13)>>
<<set _martialArtsNPC = random(3, 6)>>
<<set _enemyEXP = random(245, 370)>>
<<set _spiritualRootNPC = random(3, 6)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _loot = [
{item: $serpentmarkscale, chance: 45},
{item: $nineleaflotus, chance: 25},
{item: $moonlitjadefragment, chance: 20},
{item: $riverpearlscale, chance: 20},
{item: $serpentpulsesalve, chance: 40}
]>>
<<set _description = "An ancient serpent more than twenty meters long, its scales a deep glacial blue that glints like cut ice. It has coiled around this particular peak for so long that moss grows on its upper rings. Its qi pressure alone makes the air hard to breathe.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>
<</silently>>\
<</widget>>\<<if !$visibleMissions or $visibleMissions.length == 0>>
<<refreshMissions>>
<</if>>
<div class="bounty-board-container">
<div class="bounty-header">
<h2>⚔️ Bounty Board</h2>
<p class="bounty-subtitle">Available missions in <<print $currentRegion>></p>
</div>
<div class="missions-list">
<<for _mission range $visibleMissions>>
<div class="mission-entry">
<div class="mission-top">
<div class="mission-info">
<span class="mission-name"><<print _mission.name>></span>
<!-- KNOWN COMBAT: Show danger with skulls -->
<<if _mission.isCombat eq true>>
<div class="danger-indicator">
<<getDangerDisplay _mission.actualDangerLevel>>
<span class="danger-level">Lv. <<print _mission.actualDangerLevel>></span>
</div>
<!-- UNKNOWN COMBAT: Show ??? -->
<<elseif _mission.isCombat eq "unknown">>
<div class="danger-indicator">
<span class="danger-unknown">Danger: ???</span>
</div>
<</if>>
</div>
<div class="mission-reward">
<span class="reward-value"><<print _mission.reward>></span>
<span class="reward-label">spirit stones</span>
</div>
</div>
<p class="mission-description"><<print _mission.description>></p>
<!-- KNOWN COMBAT: Show enemy realm -->
<<if _mission.isCombat eq true>>
<div class="mission-enemy-info">
<span class="enemy-label">Enemy:</span>
<span class="enemy-realm"><<print _mission.estimatedRealm>></span>
<<if _mission.estimatedStage neq "" and _mission.estimatedStage neq null>>
<span class="enemy-stage">[<<print _mission.estimatedStage>>]</span>
<</if>>
</div>
<!-- UNKNOWN COMBAT: Show ??? -->
<<elseif _mission.isCombat eq "unknown">>
<div class="mission-enemy-info">
<span class="enemy-label">Possible Threat:</span>
<span class="enemy-unknown">??? Unknown ???</span>
</div>
<</if>>
<div class="mission-actions">
<<if $SideMissionStatus is null>>
<<capture _mission>>
<<link "✓ Accept Mission" "Bounty Board">>
<<set $MissionType to "side">>
<<set $activeSideMission to clone(_mission)>>
<<set $SideMissionStatus to "accepted">>
<<replace "#missionlog">>
<div class="mission-accepted">
✓ Accepted: <strong><<= _mission.name>></strong>
</div>
<</replace>>
<</link>>
<</capture>>
<</if>>
</div>
</div>
<</for>>
</div>
<div id="missionlog"></div>
<<if $activeSideMission neq null>>
<div class="active-mission-panel">
<h3>🎯 Current Mission</h3>
<p><strong><<print $activeSideMission.name>></strong></p>
<!-- KNOWN COMBAT: Show expected enemy -->
<<if $activeSideMission.isCombat eq true>>
<p class="enemy-info">Expected Enemy: <<print $activeSideMission.estimatedRealm>>
<<if $activeSideMission.estimatedStage neq "" and $activeSideMission.estimatedStage neq null>>
[<<print $activeSideMission.estimatedStage>>]
<</if>>
</p>
<!-- UNKNOWN COMBAT: Show unknown status -->
<<elseif $activeSideMission.isCombat eq "unknown">>
<p class="enemy-info">Possible Threat: ??? Unknown ???</p>
<</if>>
<p class="reward-info">Reward: <<print $activeSideMission.reward>> spirit stones</p>
<div class="mission-controls">
<br>
<<link "❌ Abandon Mission" "Bounty Board">>
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<<replace "#missionlog">>
<div class="mission-abandoned">
✗ Mission abandoned
</div>
<</replace>>
<</link>>
</div>
</div>
<</if>>
<div class="bounty-controls">
<<link "🔄 Refresh Missions" "Bounty Board">>
<<refreshMissions>>
<</link>>
<br>
<<link "⬅️ Return" $passage>><</link>>
</div>
</div><<if $mainStageStarted eq "false">>
You cautiously approach the source of the light. As you draw near, you discover a small, swirling entrance—a shimmering portal, deliberately hidden beneath layers of sealing arrays.
Before you can react, an unknown force grabs you, pulling you through the portal with overwhelming power!
<<timed 2s>>
You lose consciousness for a moment. When you open your eyes, you find yourself standing in a hidden, subterranean realm. Ancient runes glow faintly, but they aren't meant to keep intruders out—they are meant to hide this place from the sky above.
<<linkappend "Continue">>
As you step deeper into the ancient tomb, the air grows heavy and suffocating. Dust floats in the dim, golden light leaking from cracks in the ceiling.
At the far end of the chamber lies a raised platform. An ornate coffin rests at its center, flanked by shattered statues of phoenixes. The atmosphere is thick with spiritual pressure, a desperate, lingering will.
Suddenly, a faint blue mist rises from the coffin—gathering into a fractured, humanoid form.
<span class="soul">"So... a mortal seed wanders into the ashes. Or did the Heavenly Bureaucracy finally find me?"</span>
You tense instinctively. The presence is immense, but it feels like a dying ember.
<span class="player">"I am no heavenly envoy. Who are you?"</span>
The mist wavers, flickering with ancient, unyielding fury.
<span class="soul">"I was Yu Wei, Shield-Bearer of the Blazing Phoenix Sect. But names are meaningless now. I am the last echo of a rebellion that failed."</span>
He drifts closer, his hollow eyes piercing right through your dantian.
<span class="soul">"Your cultivation is pitiful. A mere insect in the grass. Yet... you are untainted by the Heavens' brand. I have no choice. The truth of this world must be carried out of this grave."</span>
You hesitate. <span class="player">"What truth?"</span>
<span class="soul">"That the 'Ascension' you mortals pray for is a slaughterhouse."</span>
The air hums with resonance. The tomb grows dim.
<span class="soul">"Let me show you the Great Harvest. Let me show you what the Immortals do when their spiritual energy runs low..."</span>
<<linkappend "The world shifts. Your mind is pulled into the immortal's final memory.">>
You stand at the edge of a burning world. The skies are torn open, revealing colossal, golden figures looking down from the clouds. They do not wield weapons; they wield massive, spatial nets.
You watch in horror as thousands of flying cultivators are sucked into the sky. You see a grand sect leader, a being of unimaginable power, caught in a golden beam. He doesn't die in combat—he is refined alive, compressed until his screaming soul and centuries of cultivation are turned into a single, glowing pill.
<img src="images/Story/ancientharvester.png" width=70%>
<span class="soul">"They do not rule us. They farm us. When our plane grew too strong, they came to reap the crops."</span>
<img src="images/Story/sectharvest.png" width=70%>
<span class="soul">"We refused to be medicine for the Upper Realms. We burned so that one spark might remain."</span>
<<linkappend "Return to the Tomb">>
The vision shatters. You're back in the tomb, gasping for air. Yu Wei flickers violently, his spirit rapidly dissipating.
<span class="soul">"I hid this tomb beneath the mortal fringes to escape their Divine Sense. But my time is up."</span>
He reaches into his own ethereal chest and pulls out a crystalline, blazing seed.
<span class="soul">"This is the Sovereign Core. The foundation of a sect that bows to no heaven. Take it to the Verdant Wilds beyond the northern pass. Find a Spirit Vein. Plant it. Build a fortress in the shadows, and become the variable they cannot calculate."</span>
He thrusts the core into your chest. It burns itself into your soul.
As the light fades, the tomb begins to collapse. You are forcefully expelled from the hidden realm.
<<link "Embrace the Core's power and return to the surface." "Map|Region1">>
<<set $mainStageStarted to "true">>
<<set $baseatk +=4>><<set $basedef +=4>><<set $baseagility +=4>><<set $baseluck +=4>><<set $baseinsight +=4>>
<<set $sectFoundationSeed to true>>
<</link>>
<</linkappend>>
<</linkappend>>
<</linkappend>>
<</timed>>
<</if>>
<<if $mainStageStarted eq "true" and $mainStage eq 0>>
<<if $pe eq 0>>
The trail of dead spiritual flora leads you to the base of a weeping willow, its leaves turned a bruised, sickly purple. There, sprawled among roots that seem to be drinking from his wounds, lies a man. His robes are shredded, soaked in a mixture of dark bile and oxygenated blood.
His condition is a nightmare of Qi Deviation. His skin ripples as if thousands of insects are crawling beneath the surface. In his death grip, he clutches a scroll that makes your skin crawl. It isn't made of bamboo—it is preserved human skin, inscribed with fresh blood.
<video src="images/Story/ancient_scroll.mp4" class="nsfw-glow" autoplay loop muted playsinline></video>
The man’s head snaps toward you. His eyes are swirling vortices of chaotic smoke.
<span class="male">"The heavens are a lie!"</span> he rasps, a spray of blood hitting the grass. <span class="male">"We read the ancient steles! We saw the Harvest! The only way to survive the Upper Realm is to become a monster before they do!"</span>
He thrusts the skin-scroll toward you.
<span class="male">"Take it... The Essence Leech! It’s the only way to grow fast enough to hide from their sight! We ate our own master's foundation to survive... but the Qi is too violent! Don't look at it! DON'T—"</span>
He collapses into a fit of violent coughing. The scroll pulses against your palm, offering a shortcut to immense power at the cost of your humanity.
<<link "Incinerate the scroll. Refuse the cannibalistic Dao." "MainMissionStart">><<set $pe to 1>><<set $mainStage0choice to "incinerate">><</link>>
<<link "Learn the forbidden technique and leave him." "MainMissionStart">><<set $pe to 2>><<set $mainStage0choice to "learn">><</link>>
<<link "Use the forbidden technique to consume his remaining life-force." "MainMissionStart">><<set $pe to 3>><<set $mainStage0choice to "consume">><</link>>
<<elseif $pe eq 1>>
To keep this would be to invite the same madness that broke his soul, and to become no better than the Immortals who treat mortals like livestock. You channel your Qi—not to take, but to cleanse.
<span class="player">"If I must defy the heavens, I will do it with my own strength, not the stolen lives of others."</span>
As you ignite your spiritual fire, the human-skin scroll shrieks. It curls into white ash, and the heavy scent of rot is replaced by the smell of rain. The cultivator’s body relaxes, his jagged veins fading into a peaceful grey. In the ashes, a single crystalline seed remains—pure Celestial Dew.
<span class="male">"Thank... you... sister..."</span> his final whisper carries on the wind.
<<link "Leave the area quickly." "Map|Region1">>
<<set $righteousreputation += 35>>
<<set $daoAlignment += 10>> /* Positive for Righteous */
<<set $activeDaoImprint = $harmonizedessence>>
<<set $mainStage += 1>>
<</link>>
<<elseif $pe eq 2>>
You look at the dying man. He is already a ghost; his power is fleeting, but the knowledge on this skin is eternal. If you are to build a sect to defy the Great Harvest, you cannot afford to ignore any advantage, no matter how foul.
<span class="player">"Your sacrifice is noted. I will carry this burden so you don't have to."</span>
You memorize the agonizing characters of the Essence Leech. Each word feels like a cold needle stitching itself into your brain. You tuck the scroll into your robes. The man reaches out, begging for an end you do not give.
You turn your back on him, walking away with a secret that will rapidly accelerate your future disciples' growth—if it doesn't drive them mad first.
<<link "Leave the area quickly." "Map|Region1">>
<<set $demonicreputation += 10>>
<<set $sectLibraryUnlock_EssenceLeech to true>>
<<set $activeDaoImprint = $devouringessence>>
<<set $mainStage += 1>>
<</link>>
<<elseif $pe eq 3>>
The air is thick with the scent of his failing life. To let it dissipate into the atmosphere is a waste of resources. The Immortals harvest the weak; why shouldn't you?
<span class="player">"Why let your cultivation return to the world when it can fuel my rebellion? Consider this your final contribution."</span>
You place your hand directly over the man’s shattering Dantian. You don't just learn the technique; you execute it.
<span class="male">"NO! PLEASE—AGHHH!"</span>
His scream is cut short as his body begins to collapse inward. You feel a rush of hot, violent energy surge up your arm—raw, unrefined Qi, flavored with his terror. His skin turns to dry parchment. When you stand up, you feel a terrifying strength thrumming in your veins. Your shadow seems just a little darker, and the heavens feel a little closer.
<<link "Leave the area quickly." "Map|Region1">>
<<set $baseatk +=3>><<set $basedef +=3>><<set $baseagility +=3>><<set $baseluck +=3>><<set $baseinsight +=3>>
<<set $demonicreputation += 35>>
<<set $daoAlignment -= 15>> /* Negative for Demonic */
<<set $sectExposure += 5>> /* The Heavens noticed that dark spike in Qi */
<<set $activeDaoImprint = $devouringessence>>
<<set $corruption += 15>>
<<set $mainStage += 1>>
<</link>>
<</if>>
<</if>><<set $mainStageStarted = "false">>
<<set $mainStage = 0>><<set $missionpassage to passage()>>
<!-- ROGUE CULTIVATOR MISSION EXAMPLE -->
<<if $activeSideMission.id eq "killRogueCultivator01">>
<<if $pe eq 0>>
The moment you step into the clearing, the atmosphere thickens with killing intent. A faint metallic scent lingers in the air—blood, fresh and unclean.
In the distance, a lone figure stands atop a jagged stone. His robes are tattered, eyes wild with madness. Blackened qi coils around him like serpents, writhing with instability.
His cultivation has clearly deviated from the righteous path.
As his gaze locks onto yours, a wicked grin spreads across his face.
<!-- CRITICAL: Pass mission's enemy realm/stage to CreateNPC001 -->
<<if $activeSideMission.enemyRealm>>
<<set _targetRealm to $activeSideMission.enemyRealm>>
<<set _targetStage to $activeSideMission.enemyStage>>
<</if>>
<!-- Create the enemy NPC -->
<<CreateNPC001>>
<!-- Display what we're facing -->
<div class="enemy-threat-display">
<p><strong>Opponent:</strong> <<print _npc.realm>></p>
<<if $activeSideMission.actualDangerLevel>>
<p><strong>Threat Level:</strong> <<getDangerDisplay $activeSideMission.actualDangerLevel>></p>
<</if>>
</div>
<!-- Begin combat -->
<<BeforeBattle>>
<<link "⚔️ To battle!" "MissionBattle1">>
<<set $passage to "MissionBattle1">>
<<set $pe to 0>>
<<set $nextPe to 1>>
<</link>>
<br><<link "Flee before enemy sees you" "Map|Region1">><</link>>
<<elseif $pe eq 1>>
The rogue cultivator staggers back, coughing blood. His corrupted qi twists violently before dispersing into nothingness.
He falls to his knees, eyes briefly clearing of madness.
<span class="male1">"Perhaps... I was not entirely wrong..."</span> he whispers before collapsing.
You've eliminated the threat!
<<startStatChanges>>
<<gainStat "basemartialArts" "Martial Arts" 2 10 40>>
<<gainExp 600>>
<<set $combatFame += 5>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<set $passage to "Map|Region1">>
<<MissionFinish>>
<<elseif $pe eq 2>>
The rogue cultivator's laughter echoes as your vision fades. His strikes were devastating.
When you awaken, you lie wounded at the edge of the forest, talismans burnt and pride fractured.
The threat still roams...
<<startStatChanges>>
<<gainExp 150>>
<<showStatChanges>>
You have retreated, badly wounded.
<<set $passage to "Map|Region1">>
<<MissionFailed>>
<</if>>
<</if>>
<!--Find Herb-->
<<if $activeSideMission.id eq "findHerb01">>
<<if $pe eq 0>>
The mist clings to your robes as you step into a hidden valley where moonlight filters through jagged cliffs. The air smells faintly of dew and decay.
Somewhere in this eerie stillness lies the <b>Moonshade Lily</b>, a herb that only blooms when starlight aligns with certain celestial veins in the earth.
A faint glow dances between the rocks—just within reach.
Yet something breathes, slow and guttural, in the darkness behind you...
<<link "Reach for the flower carefully" $missionpassage>><<set $pe to 1>><<set $herbApproach to "stealth">><</link>>
<<link "Charge forward and grab it" $missionpassage>><<set $pe to 1>><<set $herbApproach to "brute">><</link>>
<<elseif $pe eq 1>>
<<if $herbApproach eq "stealth">>
<<if $agility >= 6>>
Your movements are fluid as drifting mist.
Whatever creature guarded this place never senses you. You pluck the <b>Moonshade Lily</b>, its petals cool and luminous against your palm.
You leave without a sound — and with your life.
<<MissionFinish>>
<<else>>
A dry twig snaps beneath your foot. The growl comes instantly — guttural, furious.
You snatch the herb and roll away as claws slash your arm.
Blood drips, but so does victory.
Mission complete, though your wound burns faintly with something venomous...
<<set $health to $health - $health*0.1>>
<<MissionFinish>>
<</if>>
<<elseif $herbApproach eq "brute">>
<<if $strength >= 10>>
With a shout, you surge forward, qi blazing.
A monstrous silhouette lunges from the dark — too slow.
One strike of your fist sends it crashing into the rocks. You seize the lily before the dust settles.
<<set $righteousreputation +=1>>
<<MissionFinish>>
<<else>>
The beast is faster than you expected. Its claws tear through your robe as you wrench the flower free.
You stumble out, breath ragged, the <b>Moonshade Lily</b> clutched in bloodied fingers.
The valley claims its toll.
<<set $health to $health - $health*0.2>>
<<MissionFailed>>
<</if>>
<</if>>
<</if>>
<</if>>
<!--Scrool Recovery-->
<<if $activeSideMission.id eq "recoverScroll01">>
<<if $pe eq 0>>
Mist hangs over the quiet riverbank. The water glows faintly blue beneath the moonlight.
Half-submerged among the reeds is a <b>jade scroll case</b>, pulsing faintly with sealing qi.
But something stirs below the surface — the ripples too deliberate, too alive.
<<link "Use a pole to fish it out" $missionpassage>><<set $pe = 1>><<set $scrollMethod = "tool">><</link>>
<<link "Wade into the water to retrieve it directly" $missionpassage>><<set $pe = 1>><<set $scrollMethod = "direct">><</link>>
<<elseif $pe eq 1>>
<<if $scrollMethod is "tool">>
The pole trembles in your hands as you snag the case.
A sudden tug — something beneath the water tries to claim it.
You pull back hard, splashing mud and spray, until the current stills.
You’ve got it.
<<MissionFinish>>
<</if>>
<<if $scrollMethod is "direct">>
<img src="images/Sex/wet.webp" width=80%>
The water grips you with icy fingers as you wade in.
Something brushes your thigh—slick, cold, almost curious.
You snatch the scroll and leap back to the shore, heart pounding, robes soaked and clinging.
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--slay Demonic Beast-->
<<if $activeSideMission.id eq "slayDemonicBeast01">>
<<if $pe eq 0>>
The old shrine lies in ruin.
Statues of forgotten gods crumble beneath black vines; cracked stone bleeds faint red light.
The air stinks of sulfur and death.
Then—a growl.
A creature crawls from the shadows, all bone and sinew, with burning eyes and qi that distorts the air itself.
This demonic beast feeds on sacred resentment, its every breath a curse.
<<link "Confront it head-on" $missionpassage>><<set $pe=1>><<set $approach="fight">><</link>>
<<link "Try to cleanse the shrine before engaging" $missionpassage>><<set $pe=1>><<set $approach="purify">><</link>>
<<elseif $pe eq 1>>
<<if $approach eq "fight">>
The clash is brutal. Each strike shatters rock and burns air.
In the end, you stand over its corpse, demonic ichor sizzling at your feet.
<<MissionFinish>>
<<elseif $approach eq "purify">>
You kneel before the shrine, channeling righteous qi.
The beast screams as the light tears through it—its corruption dissolving into ash.
The shrine’s cracked statues glow faintly, offering silent thanks.
<<set $righteousreputation += 1>>
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--hunt River Serpent-->
<<if $activeSideMission.id eq "huntRiverSerpent01">>
<<if $pe eq 0>>
The river runs red. Torn nets and shattered boats drift by like corpses.
Villagers whisper of a **River Serpent**—its scales shimmer like silver flame, its venom can boil flesh.
As you step to the edge, the current stirs... and the serpent rises, eyes gleaming with old hunger.
<<link "Strike as it surfaces" $missionpassage>> <<set $pe=1>> <<set $serpentAction="attack">> <</link>>
<<link "Wait patiently and bait it with qi" $missionpassage>> <<set $pe=1>><<set $serpentAction="lure">><</link>>
<<elseif $pe eq 1>>
<<if $serpentAction eq "attack">>
You leap before it can fully emerge. Qi flares, scales shatter, and water explodes in a geyser of blood.
You drag its corpse ashore, exhausted but victorious.
<<AddItemToInventory $riverpearlscale>>
<<MissionFinish>>
<<elseif $serpentAction eq "lure">>
You hold your breath, still as stone. When it nears, you strike the water with divine precision.
The beast writhes and retreats into the depths, leaving behind a shimmering scale—a token of grudging respect.
<<AddItemToInventory $serpentmarkscale>>
<<set $insight += 1>>
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--rescue Missing Disciple-->
<<if $activeSideMission.id eq "rescueMissingDisciple01">>
<<if $pe eq 0>>
Fog clings to the cliffs of **Hundred Sorrows Mountain**, damp and suffocating.
You hear faint cries echoing between stone and wind.
Torn talismans, a broken sword, blood on the path… and a weak voice calling from the depths of a cave.
Inside, a many-eyed beast crouches over a wounded disciple.
<<link "Charge in to fight the creature" $missionpassage>> <<set $pe=1>><<set $rescueMethod="fight">><</link>>
<<link "Use stealth to draw it away" $missionpassage>> <<set $pe=1>><<set $rescueMethod="lure">><</link>>
<<elseif $pe eq 1>>
<<if $rescueMethod eq "fight">>
You roar and strike. The creature’s limbs thrash; its eyes burst one by one under your blows.
The disciple trembles but lives. You carry them to safety.
Mission complete.
<<set $righteousreputation += 1>>
<<MissionFinish>>
<<elseif $rescueMethod eq "lure">>
You toss a stone, masking your qi. The beast follows the sound.
You slip in, grab the disciple, and flee before it returns.
Both of you live — but nightmares will remain.
<br><<gainStat "insight" "baseinsight" 1 0 40 "Insight">>
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--collect VenomSacs -->
<<if $activeSideMission.id eq "collectVenomSacs01">>
<<if $pe eq 0>>
The dense forest air is humid and stifling. Glowing mushrooms light your path through a tangle of vines and roots. Beneath your feet, faint skittering warns of nearby danger.
Soon, you hear it—the rhythmic clicking of pincers. Forest scorpions. Their stingers drip with glistening venom, potent enough to melt bone.
You steel yourself. Alchemists pay well for these sacs… but the price is always blood.
The forest is thick with buzzing and clicking sounds. You spot two groups of scorpions clustered near glowing mushrooms.
One group is larger but more aggressive; the other smaller and less active.
<<link "Go for the larger group for more venom" $missionpassage >><<set $pe to 1>><<set $scorpionGroup to "large">><</link>>
<<link "Choose the smaller group for safety" $missionpassage>><<set $pe to 1>><<set $scorpionGroup to "small">><</link>>
<<elseif $pe eq 1>>
<<if $scorpionGroup eq "large">>
The larger group yields plenty of venom sacs, but several scorpions sting you before you can retreat. You manage to escape, wounded but richer.
<<set $health to $health - $health*0.15>>
<<set $gold to $gold + random(50, 70)>>
<<MissionFinish>>
<</if>>
<<if $scorpionGroup eq "small">>
The smaller group is easier to handle. You collect fewer sacs, but return unscathed. The alchemists will pay, though less generously.
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--Other Side Missions-->
<<if $activeSideMission.id eq "sparringPartner01">>
<<JuniorSpar01>>
<</if>>
<<if $activeSideMission.id eq "cleanCourtyard01">>
<<CleanCourtyard01>>
<</if>>
<<if $activeSideMission.id eq "assistAlchemy01">>
<<AssistAlchemy01>>
<</if>>
<<if $activeSideMission.id eq "patrolPerimeter01">>
<<PatrolPerimeter01>>
<</if>>
<<if $activeSideMission.id eq "deliverSupplies01">>
<<DeliverSupplies01>>
<</if>>
<<if $activeSideMission.id eq "tendBeasts01">>
<<TendBeasts01>>
<</if>>
<<if $activeSideMission.id eq "scripturePavilion01">>
<<ScripturePavilion01>>
<</if>>
<<if $activeSideMission.id eq "dormDisturbance01">>
<<DormDisturbance01>>
<</if>><<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<!--------------------------------------TOWN SIDE MISSIONS------------------------------>
<<set $sidemissions = [
{
"name": "Kill the rogue cultivator",
"reward": random(270, 350),
"description": "Find and eliminate a dangerous rogue cultivator plaguing the region.",
"gainFame": random(1, 10),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "killRogueCultivator01",
"baseDangerLevel": 3,
"dangerVariation": 1,
"isCombat": true,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Find the herb",
"reward": random(200, 300),
"description": "Retrieve the rare Crimson Moonflower herb from the location—dangerous only if encountered by beasts.",
"gainFame": random(1, 5),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "findHerb01",
"baseDangerLevel": 1,
"dangerVariation": 1,
"isCombat": false,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Recover lost scroll",
"reward": random(180, 250),
"description": "A disciple lost an important cultivation scroll near the river bend. Retrieve it before the elements destroy it.",
"gainFame": random(1, 4),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "recoverScroll01",
"baseDangerLevel": 1,
"dangerVariation": 0,
"isCombat": false,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Slay the demonic beast",
"reward": random(350, 450),
"description": "A powerful demonic beast has emerged near the old shrine. Eliminate it before it spreads chaos and corrupts the land.",
"gainFame": random(5, 10),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "slayDemonicBeast01",
"baseDangerLevel": 4,
"dangerVariation": 1,
"isCombat": true,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Hunt the river serpent",
"reward": random(350, 500),
"description": "A colossal serpent with scales like jade is terrorizing riverside villages. Slay it and end the terror.",
"gainFame": random(4, 10),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "huntRiverSerpent01",
"baseDangerLevel": 4,
"dangerVariation": 2,
"isCombat": true,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Rescue the missing disciple",
"reward": random(280, 360),
"description": "A disciple has vanished. Find them and return them safely to the sect.",
"gainFame": random(2, 8),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "rescueMissingDisciple01",
"baseDangerLevel": 3,
"dangerVariation": 1,
"isCombat": "unknown",
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Collect venom sacs",
"reward": random(220, 300),
"description": "Harvest venom sacs from the poison scorpions in the Blighted Wastes for an alchemist's next batch of medicines.",
"gainFame": random(1, 5),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "collectVenomSacs01",
"baseDangerLevel": 2,
"dangerVariation": 1,
"isCombat": false,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
}
]>>
<!--------------------------------------SECT SIDE MISSIONS-------------------------------->
<<set $SectSideMissions = [
{
"name": "Clean the Sect Courtyard",
"reward": random(3, 6),
"favor": 1,
"description": "Sweep the training ground and remove leftover debris after a sparring session.",
"gainFame": random(0, 2),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "cleanCourtyard01",
"baseDangerLevel": 0,
"dangerVariation": 0,
"isCombat": false,
"actualDangerLevel": 0,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Deliver Supplies to Outer Disciples",
"reward": random(4, 7),
"favor": 1,
"description": "Carry medicine and spirit water to the outer disciple quarters.",
"gainFame": random(1, 3),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "deliverSupplies01",
"baseDangerLevel": 0,
"dangerVariation": 0,
"isCombat": false,
"actualDangerLevel": 0,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Assist the Alchemy Hall",
"reward": random(5, 9),
"favor": 3,
"description": "Help sort herbs and clean the cauldrons for the alchemists working on breakthrough pills.",
"gainFame": random(1, 4),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "assistAlchemy01",
"baseDangerLevel": 0,
"dangerVariation": 0,
"isCombat": false,
"actualDangerLevel": 0,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Patrol the Sect Perimeter",
"reward": random(6, 10),
"favor": 6,
"description": "Join a patrol squad to monitor the perimeter for intruders or demonic beasts.",
"gainFame": random(2, 5),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Disciple",
"id": "patrolPerimeter01",
"baseDangerLevel": 2,
"dangerVariation": 1,
"isCombat": false,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Sparring Partner for Junior Disciples",
"reward": random(4, 8),
"favor": 3,
"description": "Help younger disciples improve by acting as their sparring partner in basic techniques.",
"gainFame": random(1, 4),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Disciple",
"id": "sparringPartner01",
"baseDangerLevel": 1,
"dangerVariation": 0,
"isCombat": false,
"actualDangerLevel": 1,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Tend to the Spirit Beast Pens",
"reward": random(5, 9),
"favor": 2,
"description": "Feed the Elder's Spirit Cranes and clean their enclosures. Beware—one may be temperamental.",
"gainFame": random(0, 2),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "tendBeasts01",
"baseDangerLevel": 1,
"dangerVariation": 1,
"isCombat": false,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null,
"twistEvent": "beastHeat"
},
{
"name": "Organize the Scripture Pavilion",
"reward": random(6, 10),
"favor": 4,
"description": "Sort returned jade slips and dust the ancient bamboo scrolls in the pavilion archives.",
"gainFame": random(1, 3),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "scripturePavilion01",
"baseDangerLevel": 0,
"dangerVariation": 0,
"isCombat": false,
"actualDangerLevel": 0,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null
},
{
"name": "Investigate Dormitory Disturbance",
"reward": random(8, 12),
"favor": 6,
"description": "An Elder has complained of strange noises from the Outer Disciple dorms at night. Investigate and report findings.",
"gainFame": random(3, 6),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Disciple",
"id": "dormDisturbance01",
"baseDangerLevel": 2,
"dangerVariation": 1,
"isCombat": false,
"actualDangerLevel": null,
"estimatedPower": null,
"estimatedRealm": null,
"estimatedStage": null,
"twistEvent": "secretLovers"
}
]>><!-- ═════════════════════════════════════════════════════════════
TOURNAMENT HOST & FORMAT RANDOMIZER
Xianxia setting with random rumors & formats
═════════════════════════════════════════════════════════════ -->
<<widget "generateTournamentHost">>
/*
Creates a random tournament host with:
- Random name
- Random title/position
- Random personality/alignment
- Random rumors based on HOST, not player
*/
<<set _hostRealm = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm"].random()>>
<<set _hostStage = ["Early", "Middle", "Late"].random()>>
<!-- Host backgrounds -->
<<set _hostType = ["City Lord", "Sect Elder", "Wandering Cultivator", "Noble Family Head", "Retired Immortal"].random()>>
<!-- Random host names (male/female) -->
<<set _isMaleHost = [true, false].random()>>
<<if _isMaleHost>>
<<set _hostFirstName = ["Lin", "Zhou", "Wang", "Zhang", "Li", "Huang", "Chen", "Wu", "Duan", "Shen"].random()>>
<<set _hostSurname = ["Feng", "Yang", "Jun", "Yuan", "Ming", "Hao", "Tao", "Qi"].random()>>
<<else>>
<<set _hostFirstName = ["Yue", "Xue", "Mei", "Qing", "Ling", "Hua", "Fang", "Lan"].random()>>
<<set _hostSurname = ["Yu", "Luo", "Shen", "Ye", "Xiao", "Su", "Ning", "Mo"].random()>>
<</if>>
<<set _hostFullName to _hostSurname + " " + _hostFirstName>>
<!-- Host personality (affects rumors) -->
<<set _hostAlignment = ["Righteous", "Neutral", "Demonic", "Hedonistic", "Scholarly", "Prideful"].random()>>
<!-- Tournament format -->
<<set _tournamentFormat = [
"Martial Elimination",
"Arena Survival",
"Heavenly Stair Challenge",
"Pill Refining Contest",
"Team Tournament"
].random()>>
<!-- Generate rumors BASED ON HOST ALIGNMENT, not player corruption -->
<<set _rumor to "">>
<<switch _hostAlignment>>
<<case "Righteous">>
<<set _rumor = "They say he seeks only the most virtuous cultivators and rewards merit fairly.">>
<<case "Demonic">>
<<set _rumor = "Whispers suggest he bets heavily on the outcomes. Winners who catch his attention disappear for weeks.">>
<<case "Hedonistic">>
<<if _isMaleHost>>
<<set _rumor = "Rumor has it the lord invites attractive female winners to 'celebrate' the victory privately.">>
<<else>>
<<set _rumor = "Rumor has it the lady invites charming male winners to 'celebrate' the victory privately.">>
<</if>>
<<case "Scholarly">>
<<set _rumor = "He's obsessed with studying cultivation techniques. Winners are questioned extensively about their methods.">>
<<case "Prideful">>
<<set _rumor = "They say he only respects those who can challenge his pride. Winning too easily results in public humiliation.">>
<<case "Neutral">>
<<set _rumor = "Nobody quite knows what he wants. Some say he runs tournaments just to observe cultivators.">>
<</switch>>
<!-- Store in object -->
<<set $tournamentHost = {
name: _hostFullName,
title: _hostType,
realm: _hostRealm,
stage: _hostStage,
alignment: _hostAlignment,
isMale: _isMaleHost,
rumor: _rumor,
format: _tournamentFormat,
prize: random(500, 1500),
location: ["City Grand Arena","Dragon Coliseum","Golden Phoenix Pavilion","Nine Heavens Arena",].random()
}>>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
TOURNAMENT LOCATION DESCRIPTIONS
═════════════════════════════════════════════════════════════ -->
<<widget "getTournamentLocationDescription">>
/* $args[0]: location name */
<<set _location to $args[0]>>
<<switch _location>>
<<case "City Grand Arena">>
<p>
The largest structure within the city walls. Tens of thousands of spectators fill the stone stands while merchants, nobles, and cultivators compete for the best viewing spots. Massive formations protect the audience from stray techniques.
</p>
<<case "Dragon Coliseum">>
<p>
A colossal arena commissioned centuries ago by a powerful cultivator. Carved dragon statues watch over the battlefield while formation arrays reinforce every inch of the combat grounds.
</p>
<<case "Dragon Coliseum">>
<p>A massive circular structure shaped like a dragon coiled around the fighting pit. Statues of legendary beasts line the walls, and the ground bears scorch marks from centuries of intense battles.</p>
<<case "Golden Phoenix Pavilion">>
<p>
Built by wealthy merchant clans, this magnificent arena combines luxury with martial tradition. Private viewing platforms surround the battlefield, occupied by influential sect elders and city officials.
</p>
<<case "Nine Heavens Arena">>
<p>
Floating platforms hover above the central arena through powerful formations. Contestants often battle both opponents and the unstable terrain itself.
</p>
<</switch>>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
TOURNAMENT FORMAT DESCRIPTIONS
═════════════════════════════════════════════════════════════ -->
<<widget "getTournamentFormatDescription">>
/* $args[0]: format name */
<<set _format to $args[0]>>
<<switch _format>>
<<case "Martial Elimination">>
<p>
<strong>Martial Elimination:</strong>
The traditional tournament format. Lose once and your journey ends. Each victory advances you toward the championship and greater rewards.
</p>
<<case "Arena Survival">>
<p>
<strong>Arena Survival:</strong>
Dozens of cultivators enter the arena simultaneously. Alliances form and shatter in moments. Survive until only a handful remain.
</p>
<<case "King of the Hill">>
<p>
<strong>King of the Hill:</strong>
A spirit platform appears at the center of the arena. Contestants earn points by controlling it while fending off challengers from every direction.
</p>
<<case "Heavenly Stair Challenge">>
<p>
<strong>Heavenly Stair Challenge:</strong>
An ancient formation manifests a staircase reaching toward the heavens. Each step places greater pressure upon the body, mind, and soul.
</p>
<<case "Pill Refining Contest">>
<p>
<strong>Pill Refining Contest:</strong>
Contestants race against time to refine the highest-quality pill possible. Precision and control are valued more than combat strength.
</p>
<<case "Team Tournament">>
<p>
<strong>Team Tournament:</strong>
Cultivators fight in small groups. Strategy, teamwork, and coordination often overcome individual strength.
</p>
<</switch>>
<</widget>>
<<widget "initializeTournamentFormat">>
<<set _format to $args[0] ?? $tournamentHost.format>>
<<switch _format>>
<<case "Martial Elimination">>
<<set $tournamentData = {
format: _format,
round: 1,
wins: 0,
losses: 0,
opponentsRemaining: 31
}>>
<<case "Arena Survival">>
<<set $tournamentData = {
format: _format,
turn: 1,
survivors: 64,
points: 0,
kills: 0
}>>
<<case "Heavenly Stair Challenge">>
<<set $tournamentData = {
format: _format,
currentStep: 1,
highestStep: 1,
pressure: 0
}>>
<<case "Pill Refining Contest">>
<<set $tournamentData = {
format: _format,
timeRemaining: 20,
purity: 0,
stability: 0,
quality: 0
}>>
<<case "Team Tournament">>
<<set $tournamentData = {
format: _format,
round: 1,
wins: 0,
losses: 0,
allies: [],
allyHealth: []
}>>
<</switch>>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
DIFFICULTY SCALING - Based on User's Index System
═════════════════════════════════════════════════════════════ -->
<<widget "applyDifficultyScaling">>
/*
$args[0]: Tournament round (1=Prelim, 2=Top16, 3=Top8, 4=Finals, 5=Championship)
Sets _targetRealm and _targetStage for CreateNPC001
*/
<<set _tournamentRound to $args[0] ?? 1>>
/* Get Player Indices */
<<set _pRealmIdx to $cultivationRealms.indexOf($cultivationRealm)>>
<<set _pStageIdx to $cultivationStages.indexOf($cultivationStage)>>
<<if _pRealmIdx < 0>><<set _pRealmIdx = 0>><</if>>
<<if _pStageIdx < 0>><<set _pStageIdx = 0>><</if>>
<<set _maxRealmIdx = $cultivationRealms.length - 1>>
/* Rolls */
<<set _rollRealm to random(1, 100)>>
<<set _rollStage to random(1, 100)>>
<<set _finalRoll to random(1, 100)>>
/* Default shifts */
<<set _realmShift = 0>>
<<set _stageShift = 0>>
/* ROUND LOGIC */
<<if _tournamentRound is 1>>
/* PRELIMINARY */
<<set _realmShift = -1>>
<<set _stageShift = -1>>
<<elseif _tournamentRound is 2>>
/* TOP 16 */
<<if _rollRealm lte 60>>
<<set _realmShift = 0>>
<<elseif _rollRealm lte 85>>
<<set _realmShift = -1>>
<<else>>
<<set _realmShift = 1>>
<</if>>
<<if _rollStage lte 50>>
<<set _stageShift = 0>>
<<elseif _rollStage lte 80>>
<<set _stageShift = -1>>
<<else>>
<<set _stageShift = 1>>
<</if>>
<<elseif _tournamentRound is 3>>
/* TOP 8 */
<<if _rollRealm lte 70>>
<<set _realmShift = 0>>
<<else>>
<<set _realmShift = 1>>
<</if>>
<<if _rollStage lte 50>>
<<set _stageShift = 1>>
<<else>>
<<set _stageShift = 0>>
<</if>>
<<elseif _tournamentRound is 4>>
/* FINALS */
<<set _realmShift = 0>>
<<set _stageShift = 1>>
<<elseif _tournamentRound is 5>>
/* CHAMPIONSHIP */
<<set _isLateStage to _pStageIdx === 2>>
<<set _canAdvanceRealm to _pRealmIdx < _maxRealmIdx>>
<<if _isLateStage and _canAdvanceRealm and _finalRoll lte 50>>
<<set _realmShift = 1>>
<<set _stageShift = 0>>
<<else>>
<<set _realmShift = 0>>
<<set _stageShift = 1>>
<</if>>
<</if>>
/* APPLY CLAMP */
<<set _enemyRealmIdx = Math.max(0, Math.min(_maxRealmIdx, _pRealmIdx + _realmShift))>>
<<set _enemyStageIdx = Math.max(0, Math.min(2, _pStageIdx + _stageShift))>>
/* SAFETY FALLBACK */
<<if _enemyRealmIdx < 0 or _enemyRealmIdx > _maxRealmIdx>>
<<set _enemyRealmIdx = _pRealmIdx>>
<</if>>
<<if _enemyStageIdx < 0 or _enemyStageIdx > 2>>
<<set _enemyStageIdx = _pStageIdx>>
<</if>>
/* SET TARGET FOR CREATENPC001 */
<<set _targetRealm to $cultivationRealms[_enemyRealmIdx]>>
<<set _targetStage to $cultivationStages[_enemyStageIdx]>>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
SINGLE ELIMINATION OPPONENT GENERATION
═════════════════════════════════════════════════════════════ -->
<<widget "generateSingleEliminationOpponent">>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<</widget>><!-- ═════════════════════════════════════════════════════════════
MARTIAL ELIMINATION - VICTORY & DEFEAT OUTCOMES
Based on host alignment and tournament stage
═════════════════════════════════════════════════════════════ -->
<<widget "getMartialEliminationVictory">>
/*
Champion victory for Martial Elimination
Varies based on $tournamentHost.alignment
*/
<<set _hostName to $tournamentHost.name>>
<<set _hostTitle to $tournamentHost.title>>
<<set _hostAlign to $tournamentHost.alignment>>
<div class="tournament-victory">
<h2>⚔️ CHAMPIONSHIP VICTORY!</h2>
<<switch _hostAlign>>
<<case "Righteous">>
<p>The final opponent falls before your overwhelming technique. The crowd erupts in cheers as you stand victorious.</p>
<p><<print _hostName>> approaches, a look of genuine respect in their eyes.</p>
<p><span class="male">"You have proven yourself worthy through skill, courage, and honor. This victory is yours by right."</span></p>
<p>The crowd bows. <<print _hostName>> places the championship insignia around your neck personally.</p>
<p><span class="male">"Go forth. The Jianghu will hear of your name. Perhaps one day you will surpass even me."</span></p>
<<set $fame += 50>>
<<set $combatFame += 50>>
<<set $gold += 1000>>
<<case "Demonic">>
<p>Your final opponent crumples to the ground, barely conscious. You are the last one standing.</p>
<p><<print _hostName>> appears at the arena edge, eyes gleaming with dark appreciation.</p>
<p><span class="male">"Exquisite brutality. You have the instincts of a true killer. Few possess such... potential."</span></p>
<p>The host's smile is unsettling. <span class="male">"Tell me, champion — have you ever considered working for someone? The kind of power you possess could be... leveraged."</span></p>
<p>A heavy purse is tossed at your feet, along with a jade token bearing a dark insignia.</p>
<p><span class="male">"When you tire of righteousness, find me. We could do terrible things together."</span></p>
<<set $fame += 40>>
<<set $combatFame += 50>>
<<set $gold += 800>>
<<set $sectSuspicion += 5>>
<<case "Hedonistic">>
<p>Your opponent surrenders rather than face another blow. Victory is yours.</p>
<p><<print _hostName>> descends into the arena with several attendants, face flushed with excitement.</p>
<p><span class="male">"What a magnificent display! Your power, your grace, your... presence. Absolutely intoxicating."</span></p>
<p>The host circles you, appraising. <span class="male">"A champion must celebrate properly. I insist you join my private gathering tonight. The finest wines, the finest company... and perhaps something more?"</span></p>
<p>Before you can respond, the host snaps their fingers. Servants arrive with luxurious robes and a personal invitation.</p>
<p><span class="male">"Come. Let us discuss your... future endeavors."</span></p>
<<set $fame += 35>>
<<set $combatFame += 50>>
<<set $gold += 900>>
<<set $corruption += 5>>
<<case "Scholarly">>
<p>The final match concludes with a breathtaking display of technique. Your opponent acknowledges defeat with respect.</p>
<p><<print _hostName>> practically sprints to the arena, eyes wide with intellectual fervor.</p>
<p><span class="male">"EXTRAORDINARY! Your cultivation method — the flow of energy, the technique sequencing — I detected seven distinct styles interwoven! How did you synthesize such incompatible approaches?"</span></p>
<p>The host begins furiously taking notes, barely pausing for breath.</p>
<p><span class="male">"You must allow me to document your techniques. For scholarship, you understand. I'll pay handsomely for detailed explanations of your abilities."</span></p>
<p>Several scrolls and a heavy coin purse are thrust toward you.</p>
<<set $fame += 45>>
<<set $combatFame += 50>>
<<set $gold += 950>>
<<case "Prideful">>
<p>You demolish your final opponent, proving beyond doubt your superiority.</p>
<p><<print _hostName>> stands slowly, expression unreadable. The arena falls silent.</p>
<p><span class="male">"I see. So you are the stronger cultivator."</span> The host's voice is cold, calculating.</p>
<p><span class="male">"Few have ever forced me to acknowledge such a thing. It is... humbling."</span> A pause, heavy with meaning.</p>
<p><span class="male">"Guard that victory well. There are those who will resent your success. And know this — should we ever meet in true combat, I will not hold back."</span></p>
<p>The champion prize is presented without ceremony. <<print _hostName>> watches with eyes that promise future challenges.</p>
<<set $fame += 60>>
<<set $combatFame += 60>>
<<set $gold += 750>>
<<case "Neutral">>
<p>Your final opponent falls. You are the champion.</p>
<p><<print _hostName>> observes from their seat, expression neutral.</p>
<p><span class="male">"You have proven stronger than your peers. The tournament concludes."</span></p>
<p>The host stands, offering a respectful bow — neither warm nor cold.</p>
<p><span class="male">"Perhaps we shall meet again. Until then, carry this victory with humility."</span></p>
<p>The champion's prize is delivered formally. <<print _hostName>> watches as you depart, expression still unreadable.</p>
<<set $fame += 40>>
<<set $combatFame += 50>>
<<set $gold += 800>>
<</switch>>
</div>
<</widget>>
<<widget "getMartialEliminationDefeat">>
/*
$args[0]: Stage defeated at (1=Prelim, 2=Top16, 3=Top8, 4=Top4, 5=Championship)
Defeat text for Martial Elimination
*/
<<set _stageDefeated to $args[0] ?? 1>>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<div class="tournament-defeat">
<<if _stageDefeated is 1>>
<!-- PRELIMINARY DEFEAT -->
<p>Your opponent's technique overwhelms you. You fall to your knees, unable to continue.</p>
<p>The crowd watches indifferently as you're helped from the arena. Many stronger cultivators remain.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><span class="male">"You fought with honor. Better luck next time. The tournament is unforgiving."</span></p>
<<case "Demonic">>
<p><<print _hostName>> doesn't even glance your way. You're dismissed immediately, forgotten.</p>
<<case "Hedonistic">>
<p><<print _hostName>> looks momentarily disappointed. <span class="male">"A shame. You were... promising."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> makes brief notes. <span class="male">"Interesting technique, but insufficient control."</span></p>
<<case "Prideful">>
<p><<print _hostName>> shows no reaction. You're beneath notice.</p>
<<case "Neutral">>
<p><<print _hostName>> nods neutrally. <span class="male">"The strong advance."</span></p>
<</switch>>
<<set $combatFame += 1>>
<<set $fame += 1>>
<<set $gold += 25>>
<<elseif _stageDefeated is 2>>
<!-- ROUND OF 16 DEFEAT -->
<p>You fought valiantly, but your opponent proves too skilled. After a grueling battle, you're forced to yield.</p>
<p>As you leave the arena, the crowd shows respect — you've earned your place among the best sixteen.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> nods approvingly as you depart. <span class="male">"You fought with honor. Return stronger."</span></p>
<<case "Demonic">>
<p><<print _hostName>> leans forward, studying you with renewed interest. <span class="male">"Hmm. Stronger than expected."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> offers encouragement. <span class="male">"You've come far. Perhaps next time, we celebrate your victory."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> approaches with questions. <span class="male">"That technique in round three — where did you learn it?"</span></p>
<<case "Prideful">>
<p><<print _hostName>> barely acknowledges you. You're closer to their level, but still not quite there.</p>
<<case "Neutral">>
<p><<print _hostName>> observes neutrally. <span class="male">"You have progressed."</span></p>
<</switch>>
<<set $combatFame += 5>>
<<set $fame += 5>>
<<set $gold += 100>>
<<elseif _stageDefeated is 3>>
<!-- TOP 8 DEFEAT -->
<p>You've reached the elite eight, but your opponent's power overwhelms you. A final, devastating strike ends the match.</p>
<p>The crowd rises in respect. You've proven yourself among the strongest cultivators here.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> stands and bows slightly to you. <span class="male">"You have shown great strength and character. Well fought."</span></p>
<<case "Demonic">>
<p><<print _hostName>> watches with intense interest. <span class="male">"Now THIS shows promise. I may remember you."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> looks genuinely impressed. <span class="male">"Making it this far is no small feat. You deserve celebration."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> examines you as if you were an fascinating specimen. <span class="male">"The techniques you demonstrated... remarkable synthesis."</span></p>
<<case "Prideful">>
<p><<print _hostName>> nods with respect — a rare honor. <span class="male">"You have strength. Not enough... but strength nonetheless."</span></p>
<<case "Neutral">>
<p><<print _hostName>> stands. <span class="male">"You have proven yourself among the elite. That is worthy."</span></p>
<</switch>>
<<set $combatFame += 15>>
<<set $fame += 15>>
<<set $gold += 250>>
<<elseif _stageDefeated is 4>>
<!-- TOP 4 / SEMIFINALS DEFEAT -->
<p>You fight with everything you have, pushing yourself to the absolute limit. But your opponent is simply superior.</p>
<p>As you fall, the crowd erupts — you've reached the final four, a monumental achievement.</p>
<p>Only three cultivators remain in contention. You are one of the four strongest here.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> personally helps you to your feet. <span class="male">"You have fought magnificently. Few reach this stage. Your name will be remembered."</span></p>
<<case "Demonic">>
<p><<print _hostName>> approaches, eyes gleaming with dark appreciation. <span class="male">"Few possess your caliber. I will not forget you."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> looks at you with genuine admiration. <span class="male">"Reaching the final four... you are exceptional. Come, let me reward your efforts properly."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> bombards you with questions about your techniques even as you catch your breath.</p>
<<case "Prideful">>
<p><<print _hostName>> stands and applauds slowly. <span class="male">"You have earned my respect. Few do."</span></p>
<<case "Neutral">>
<p><<print _hostName>> stands and bows deeply to you. <span class="male">"To reach the final four is to achieve what most can only dream of."</span></p>
<</switch>>
<<set $combatFame += 25>>
<<set $fame += 25>>
<<set $gold += 400>>
<<elseif _stageDefeated is 5>>
<!-- CHAMPIONSHIP MATCH DEFEAT -->
<p>You give everything you have. For a moment, you think you might actually win.</p>
<p>But your opponent is simply too strong. A final, overwhelming technique ends the match.</p>
<p>You are the runner-up. Second only to the greatest cultivator in this tournament.</p>
<p>The crowd is on their feet. You've reached the championship — perhaps the greatest achievement of your life.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> helps you up personally, genuine warmth in their expression.</p>
<p><span class="male">"You have fought with unparalleled honor. This loss diminishes you not. You are a true champion of the spirit."</span></p>
<p>The host places a laurel crown upon your head. <span class="male">"Go forward knowing you have reached heights few ever touch."</span></p>
<<case "Demonic">>
<p><<print _hostName>> studies you with intense interest.</p>
<p><span class="male">"You came so close to absolute power. That hunger in your eyes... I see great potential. Come — let us discuss your future."</span></p>
<p>A dark gaze holds you. <span class="male">"A second-place finish is not the end. It is merely the beginning."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> approaches with admiration and something else — pity, perhaps, or desire.</p>
<p><span class="male">"Oh, what a magnificent battle! You came so close, and fought with such passion. You must let me reward you properly for your efforts."</span></p>
<p>The host's hand lingers on your shoulder. <span class="male">"Come to my private chambers. We shall celebrate together... thoroughly."</span></p>
<<set $corruption += 10>>
<<case "Scholarly">>
<p><<print _hostName>> practically trembles with excitement.</p>
<p><span class="male">"The techniques you displayed! The innovation! I must document everything! Please, let's discuss your cultivation path in detail."</span></p>
<p>A substantial payment is offered. <span class="male">"Name your price for exclusive access to your knowledge."</span></p>
<<case "Prideful">>
<p><<print _hostName>> rises slowly, offering you the deepest respect.</p>
<p><span class="male">"You have challenged me — challenged MY tournament, MY authority. Few dare such things."</span></p>
<p><span class="male">"You lost, yes. But you reached the pinnacle. That alone warrants acknowledgment."</span></p>
<p>A formal bow. <span class="male">"Perhaps next time, you will claim the throne."</span></p>
<<case "Neutral">>
<p><<print _hostName>> stands and offers a respectful bow.</p>
<p><span class="male">"Second place in a championship of this caliber is a remarkable achievement. Few will ever reach where you have reached."</span></p>
<p><span class="male">"You may not leave here as champion, but you leave as legend."</span></p>
<</switch>>
<<set $combatFame += 40>>
<<set $fame += 40>>
<<set $gold += 600>>
<</if>>
</div>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
ARENA SURVIVAL - VICTORY & DEFEAT OUTCOMES
═════════════════════════════════════════════════════════════ -->
<<widget "getArenaSurvivalVictory">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<<set _kills to $arenaSurvivalKills ?? 0>>
<<set _health to $arenaSurvivalHealth ?? 0>>
<<set _energy to $arenaSurvivalEnergy ?? 0>>
<<set _totalEnemies to $arenaSurvivalTotalEnemies ?? 12>>
<div class="tournament-victory">
<h2>🏆 LAST ONE STANDING!</h2>
<p>Bodies litter the arena floor. Of the <<print _totalEnemies>> cultivators who entered, you alone remain.</p>
<p>You personally eliminated <strong><<print _kills>></strong> opponents.</p>
<<if $equippedRobe && $equippedRobe.durability < 20>>
<p>Your robe hangs in tatters, barely clinging to your battered frame – a badge of your brutal survival.</p>
<<elseif $equippedRobe && $equippedRobe.durability < 50>>
<p>Your robe is torn and bloodied, but still serviceable.</p>
<</if>>
<p>You stand with <strong><<print _health>></strong> health and <strong><<print _energy>></strong> energy remaining.</p>
<p>The crowd erupts in a frenzy of cheers and screams. You are the sole survivor.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> approaches, impressed by your survival instinct.</p>
<p><span class="male">"To survive is its own form of strength. You are the last warrior standing. Well earned."</span></p>
<<case "Demonic">>
<p><<print _hostName>> grins widely, delighted by the carnage you've orchestrated.</p>
<p><span class="male">"The brutality... the cunning... YES. This is what the Jianghu is truly about."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> watches you with raw appreciation, blood-spattered and victorious.</p>
<p><span class="male">"The primal energy... your strength, your intensity. Magnificent."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> examines the arena carefully, taking notes on the positioning of bodies.</p>
<p><span class="male">"Fascinating. Your tactical decisions... you eliminated threats in optimal sequence."</span></p>
<<case "Prideful">>
<p><<print _hostName>> nods with respect, recognizing superior cunning and strength.</p>
<p><span class="male">"Survival requires more than power. You possessed strategy. Intelligence. I respect that."</span></p>
<<case "Neutral">>
<p><<print _hostName>> observes dispassionately.</p>
<p><span class="male">"You survived. That was the objective. The objective is achieved."</span></p>
<</switch>>
<<set $fame += 55>>
<<set $combatFame += 55>>
<<set $gold += 1100>>
</div>
<</widget>>
<<widget "getArenaSurvivalDefeat">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<<set _kills to $arenaSurvivalKills ?? 0>>
<<set _health to $arenaSurvivalHealth ?? 0>>
<<set _energy to $arenaSurvivalEnergy ?? 0>>
<<set _remaining to $arenaSurvivalRemainingEnemies ?? 12>>
<<set _totalEnemies to $arenaSurvivalTotalEnemies ?? 12>>
/* Determine stage based on enemies left */
<<if _remaining >= 10>>
<<set _stage to 1>> <!-- Early elimination -->
<<elseif _remaining >= 6>>
<<set _stage to 2>> <!-- Mid-stage -->
<<elseif _remaining >= 3>>
<<set _stage to 3>> <!-- Final five (approx) -->
<<else>>
<<set _stage to 4>> <!-- Final three or less -->
<</if>>
<div class="tournament-defeat">
<<if _stage is 1>>
<h2>Arena Survival – Eliminated Early</h2>
<p>The chaos of dozens of cultivators clashing overwhelms you. <<print _remaining>> enemies still stalk the arena when you fall.</p>
<p>You managed to defeat <strong><<print _kills>></strong> before being overwhelmed.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> shows understanding. <span class="male">"The chaos is not for all. You fought bravely."</span></p>
<<case "Demonic">>
<p><<print _hostName>> doesn't even glance at your elimination. There are plenty more bodies.</p>
<<case "Hedonistic">>
<p><<print _hostName>> sighs with mild disappointment. <span class="male">"A shame. I had high hopes."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> makes notes. <span class="male">"Interesting failure pattern."</span></p>
<<case "Prideful">>
<p><<print _hostName>> shows no reaction.</p>
<<case "Neutral">>
<p><<print _hostName>> simply nods. <span class="male">"You did not endure."</span></p>
<</switch>>
<<set $combatFame += 2>>
<<set $fame += 2>>
<<set $gold += 50>>
<<elseif _stage is 2>>
<h2>Arena Survival – Mid-Stage Elimination</h2>
<p>You survive the initial chaos and eliminate <strong><<print _kills>></strong> opponents, but <<print _remaining>> foes remain and eventually overwhelm you.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> nods with respect. <span class="male">"You proved yourself among many. That has worth."</span></p>
<<case "Demonic">>
<p><<print _hostName>> studies you with interest. <span class="male">"You lasted longer than most. Not bad."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> shows genuine approval. <span class="male">"You fought well. Perhaps I'll remember you."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> approaches with questions about your survival tactics.</p>
<<case "Prideful">>
<p><<print _hostName>> acknowledges you with a slight nod.</p>
<<case "Neutral">>
<p><<print _hostName>> observes clinically. <span class="male">"You persisted longer than many."</span></p>
<</switch>>
<<set $combatFame += 8>>
<<set $fame += 8>>
<<set $gold += 150>>
<<elseif _stage is 3>>
<h2>Arena Survival – Top Five Elimination</h2>
<p>You've survived the chaos. Only <strong><<print _remaining>></strong> cultivators remain in the arena when you fall – a feat few achieve.</p>
<p>You took down <strong><<print _kills>></strong> opponents before succumbing.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> stands and bows to you. <span class="male">"Among the final few. That is exceptional."</span></p>
<<case "Demonic">>
<p><<print _hostName>> leans forward with dark interest. <span class="male">"Almost made it. You're stronger than most."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> looks at you with clear admiration. <span class="male">"Reaching the final handful... you are remarkable."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> enthusiastically approaches. <span class="male">"Your survival tactics were exceptional!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> nods with clear respect. <span class="male">"Few reach that stage."</span></p>
<<case "Neutral">>
<p><<print _hostName>> stands. <span class="male">"Top five is an achievement worthy of recognition."</span></p>
<</switch>>
<<set $combatFame += 20>>
<<set $fame += 20>>
<<set $gold += 300>>
<<elseif _stage is 4>>
<h2>Arena Survival – Final Fight</h2>
<p>Only <strong><<print _remaining>></strong> enemies remain when you are finally bested. You were so close.</p>
<p>You personally eliminated <strong><<print _kills>></strong> cultivators – a legendary tally.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> personally helps you up, genuine respect in their gaze.</p>
<p><span class="male">"To reach the very end... you have proven yourself a true warrior."</span></p>
<<case "Demonic">>
<p><<print _hostName>> eyes you with intense interest.</p>
<p><span class="male">"Almost the apex predator. I'll be watching you."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> approaches with undisguised admiration.</p>
<p><span class="male">"Surviving to the final moments... you are exceptional. Come celebrate with me."</span></p>
<<set $corruption += 8>>
<<case "Scholarly">>
<p><<print _hostName>> practically vibrates with excitement.</p>
<p><span class="male">"The tactical and physical developments evident in your final matches... extraordinary!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> stands and bows deeply to you.</p>
<p><span class="male">"Few possess the strength and cunning to reach where you have reached."</span></p>
<<case "Neutral">>
<p><<print _hostName>> offers a respectful bow.</p>
<p><span class="male">"Final contenders. You are legend."</span></p>
<</switch>>
<<set $combatFame += 38>>
<<set $fame += 38>>
<<set $gold += 550>>
<</if>>
<!-- Robe status mention -->
<<if $equippedRobe && $equippedRobe.durability < 20>>
<p>Your robe is completely shredded – everyone saw more than just your fighting spirit.</p>
<<elseif $equippedRobe && $equippedRobe.durability < 50>>
<p>Your robe bears deep gashes and tears, a reminder of the battle's ferocity.</p>
<</if>>
</div>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
PILL REFINING CONTEST - VICTORY & DEFEAT OUTCOMES
═════════════════════════════════════════════════════════════ -->
<<widget "getPillRefiningVictory">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<<set _score to $prScore>>
<div class="tournament-victory">
<h2>🔷 SUPREME PILL REFINER!</h2>
<p>The final pills are unveiled. Judges examine each carefully, testing quality, potency, purity.</p>
<p>Your pill stands above all others — a masterwork of alchemy and control. <strong>Quality score: <<print _score>></strong>.</p>
<p>You are declared the supreme pill refiner of this tournament.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> examines your pill with genuine appreciation.</p>
<p><span class="male">"Such precision. Such purity. This is the work of a true master."</span></p>
<<case "Demonic">>
<p><<print _hostName>> studies your pill with commercial interest.</p>
<p><span class="male">"Excellent quality. Pills like this could be worth significant fortune. Interested in a partnership?"</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> inhales the pill's aroma with obvious pleasure.</p>
<p><span class="male">"Not just functional, but... exquisite. You have both skill and refinement."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> examines your pill under a magnifying lens, taking extensive notes.</p>
<p><span class="male">"The refinement process... the structure... I've never seen such sophistication!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> studies your pill with obvious respect.</p>
<p><span class="male">"Few possess such mastery. You have surpassed your peers."</span></p>
<<case "Neutral">>
<p><<print _hostName>> examines your pill objectively.</p>
<p><span class="male">"Superior quality. Well executed."</span></p>
<</switch>>
<<set $fame += 45>>
<<set $combatFame += 30>>
<<set $gold += $tournamentHost.prize>>
</div>
<</widget>>
<<widget "getPillRefiningDefeat">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<<set _score to $prScore>>
<<set _rank to $prPlayerRank>>
<<set _total to $prTotal>>
<<if _rank is 2>>
<<set _stage to "second">>
<<elseif _rank is 3>>
<<set _stage to "finalThree">>
<<elseif _rank lte Math.ceil(_total / 2)>>
<<set _stage to "mid">>
<<else>>
<<set _stage to "low">>
<</if>>
<div class="tournament-defeat">
<<if _stage eq "second">>
<h2>🥈 Second Place – Nearly Perfect</h2>
<p>Your pill is almost flawless. The judges examine it for a long time, impressed. <strong>Score: <<print _score>></strong>.</p>
<p>It is exceptional – but one other pill surpasses it, if only by a hair.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> personally congratulates you. <span class="male">"To come so close to perfection is the mark of a master. Second here is a triumph."</span></p>
<<case "Demonic">>
<p><<print _hostName>> eyes your work with keen interest. <span class="male">"Top two. Almost made it. I could use someone of your caliber."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> admires your pill. <span class="male">"Such exquisite work. Nearly flawless. You deserve celebration for your effort."</span></p>
<<set $corruption += 5>>
<<case "Scholarly">>
<p><<print _hostName>> is ecstatic. <span class="male">"The precision! The technique! Tell me everything about your method!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> offers a formal bow. <span class="male">"Second place here is an achievement only a master could attain."</span></p>
<<case "Neutral">>
<p><<print _hostName>> bows respectfully. <span class="male">"Master-level skill. That is no small achievement."</span></p>
<</switch>>
<<set $fame += 35>>
<<set $combatFame += 35>>
<<set $gold += 550>>
<<elseif _stage eq "finalThree">>
<h2>🌟 Final Three – Exceptional Skill</h2>
<p>Your pill stands among the finest three. <strong>Score: <<print _score>></strong>. The judges clearly recognise your talent.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> bows slightly. <span class="male">"To rank in the final three shows true mastery."</span></p>
<<case "Demonic">>
<p><<print _hostName>> leans forward with interest. <span class="male">"Top three. That shows real promise."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> examines your pill with undisguised appreciation. <span class="male">"Magnificent work. Nearly perfect."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> approaches with enthusiasm. <span class="male">"Your refinement technique is nearly flawless!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> nods with respect. <span class="male">"You possess true skill."</span></p>
<<case "Neutral">>
<p><<print _hostName>> stands. <span class="male">"You demonstrated exceptional craftsmanship."</span></p>
<</switch>>
<<set $fame += 20>>
<<set $combatFame += 20>>
<<set $gold += 400>>
<<elseif _stage eq "mid">>
<h2>📿 Mid‑Tier Ranking – Solid Work</h2>
<p>Your pill earns a decent score of <<print _score>>. It’s not top‑tier, but you outperformed many.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> nods approvingly. <span class="male">"Solid work. You show real potential."</span></p>
<<case "Demonic">>
<p><<print _hostName>> shrugs. <span class="male">"Decent craftsmanship. Keep working."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> offers a polite smile. <span class="male">"Respectable effort. You have promise."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> makes notes. <span class="male">"Good technique. Room for improvement."</span></p>
<<case "Prideful">>
<p><<print _hostName>> acknowledges you faintly.</p>
<<case "Neutral">>
<p><<print _hostName>> observes. <span class="male">"Adequate craftsmanship."</span></p>
<</switch>>
<<set $fame += 8>>
<<set $combatFame += 8>>
<<set $gold += 250>>
<<else>>
<h2>💥 Lower Rankings – The Cauldron Fails You</h2>
<p>Your pill scores a meagre <<print _score>>. The judges barely glance at it. You finish near the bottom.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> is encouraging. <span class="male">"Pill refining takes time. Keep practicing."</span></p>
<<case "Demonic">>
<p><<print _hostName>> shows no interest.</p>
<<case "Hedonistic">>
<p><<print _hostName>> offers sympathy. <span class="male">"Better luck next time."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> makes notes on your pill's deficiencies.</p>
<<case "Prideful">>
<p><<print _hostName>> shows no reaction.</p>
<<case "Neutral">>
<p><<print _hostName>> nods. <span class="male">"Your skill was insufficient."</span></p>
<</switch>>
<<set $fame += 2>>
<<set $combatFame += 2>>
<<set $gold += 100>>
<</if>>
<<if _score lte 30 and $equippedRobe>>
<p>The backlash from the failed refinement has scorched your robe, leaving it frayed and embarrassing.</p>
<<set $equippedRobe.durability to Math.max(0, $equippedRobe.durability - 20)>>
<</if>>
</div>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
TEAM TOURNAMENT - VICTORY & DEFEAT OUTCOMES
═════════════════════════════════════════════════════════════ -->
<<widget "getTeamTournamentVictory">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<div class="tournament-victory">
<h2>🏆 TEAM CHAMPIONS!</h2>
<p>Your team stands victorious on the arena floor. The opposing team lies defeated.</p>
<p>You are not just a strong cultivator — you are a leader. Your team followed you to triumph.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> approaches and bows to you and your teammates.</p>
<p><span class="male">"Teamwork, honor, and strength. You have shown all three. Well earned."</span></p>
<<case "Demonic">>
<p><<print _hostName>> studies your team with interest.</p>
<p><span class="male">"You've built something powerful. A unified force. Such things are... valuable."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> watches your team with clear appreciation.</p>
<p><span class="male">"The synergy, the coordination... beautiful. You must all celebrate with me."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> approaches with countless questions.</p>
<p><span class="male">"Your team's coordination mechanics! Your role distribution strategy! Fascinating!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> nods with clear respect to you.</p>
<p><span class="male">"Few can lead a team. You have done so magnificently."</span></p>
<<case "Neutral">>
<p><<print _hostName>> observes your team's victory neutrally.</p>
<p><span class="male">"Your team proved superior. Well coordinated."</span></p>
<</switch>>
<<set $fame += 50>>
<<set $combatFame += 45>>
<<set $gold += 1000>>
</div>
<</widget>>
<<widget "getTeamTournamentDefeat">>
/*
$args[0]: Round (1=First match, 2=Semifinals, 3=Finals)
*/
<<set _roundDefeated to $args[0] ?? 1>>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<div class="tournament-defeat">
<<if _roundDefeated is 1>>
<h2>Team Tournament - First Match Defeat</h2>
<p>Your team is defeated in the opening round. The opponents proved better coordinated or stronger.</p>
<p>You're eliminated from the tournament immediately.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> shows understanding. <span class="male">"Teamwork is difficult. You tried honorably."</span></p>
<<case "Demonic">>
<p><<print _hostName>> shows no interest in defeated teams.</p>
<<case "Hedonistic">>
<p><<print _hostName>> sighs with mild disappointment.</p>
<<case "Scholarly">>
<p><<print _hostName>> makes notes on your team's failure patterns.</p>
<<case "Prideful">>
<p><<print _hostName>> shows no reaction.</p>
<<case "Neutral">>
<p><<print _hostName>> simply observes. <span class="male">"Your team was insufficient."</span></p>
<</switch>>
<<set $combatFame += 5>>
<<set $fame += 5>>
<<set $gold += 150>>
<<elseif _roundDefeated is 2>>
<h2>Team Tournament - Semifinals</h2>
<p>Your team makes it to the semifinals. You've proven superior to most other teams.</p>
<p>But the final four teams are the strongest, and you fall just short.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> nods respectfully. <span class="male">"Reaching the semifinals shows strong teamwork."</span></p>
<<case "Demonic">>
<p><<print _hostName>> shows increased interest. <span class="male">"Made it to the semis. You're stronger than most."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> looks impressed. <span class="male">"Impressive team effort. Nearly made finals."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> approaches eagerly. <span class="male">"Your team's tactical adjustments were remarkable!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> acknowledges you slightly.</p>
<<case "Neutral">>
<p><<print _hostName>> observes. <span class="male">"You demonstrated competence as a team."</span></p>
<</switch>>
<<set $combatFame += 18>>
<<set $fame += 18>>
<<set $gold += 350>>
<<elseif _roundDefeated is 3>>
<h2>Team Tournament - Finals</h2>
<p>Your team reaches the finals — the absolute pinnacle of team competition here.</p>
<p>Only two teams remain. But the opposing team proves superior in this final clash.</p>
<p>You are runners-up. Your team is second-best.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> stands and bows to you and your team.</p>
<p><span class="male">"To reach the finals requires exceptional unity and strength. You have both."</span></p>
<<case "Demonic">>
<p><<print _hostName>> eyes you with dark interest.</p>
<p><span class="male">"You brought a team to the finals. That's impressive. Imagine what you could do for me."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> looks at your team with clear admiration.</p>
<p><span class="male">"Reaching the finals together... remarkable synchronicity. You all deserve celebration."</span></p>
<<set $corruption += 8>>
<<case "Scholarly">>
<p><<print _hostName>> trembles with excitement.</p>
<p><span class="male">"The coordination in your finals match! The tactical adaptations! Tell me everything!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> stands and offers you formal respect.</p>
<p><span class="male">"You led your team to the finals. Few could do the same."</span></p>
<<case "Neutral">>
<p><<print _hostName>> bows deeply to your team.</p>
<p><span class="male">"You achieved the pinnacle of team competition. That is a legendary accomplishment."</span></p>
<</switch>>
<<set $combatFame += 40>>
<<set $fame += 40>>
<<set $gold += 600>>
<</if>>
</div>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
HEAVENLY STEP - VICTORY & DEFEAT OUTCOMES
═════════════════════════════════════════════════════════════ -->
<<widget "getHeavenlyStairVictory">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<<set _steps to $hsPlayerStep>>
<div class="tournament-victory">
<h2>🏆 ASCENDED BEYOND ALL!</h2>
<p>The staircase fades as you step onto the highest cloud. <<print _steps>> steps you climbed – more than any other soul.</p>
<p>Below you, the remaining climbers are still struggling upward, but the heavens have already acknowledged you as the victor.</p>
<<if $health lte ($maxhealth * 0.2) and $equippedRobe>>
<p>Your robe is in tatters, evidence of the brutal pressure you endured.</p>
<</if>>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> bows deeply, eyes full of respect. <span class="male">"To climb the Heavenly Stair and stand above all others… you are a true cultivator. The heavens smile upon you."</span></p>
<<case "Demonic">>
<p><<print _hostName>> grins with dark delight. <span class="male">"You crushed them. You trampled the stairs themselves. YES – this is the hunger that shakes the firmament!"</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> watches you descend the vanished steps with open admiration. <span class="male">"The way you endured… the pain, the pleasure of the climb. Marvellous. You must share a cup with me."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> is frantically scribbling notes. <span class="male">"Incredible! Your step choices, your resource conservation… the statistical improbability of your success! I must document this!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> nods, eyes narrowed with respect. <span class="male">"You did not simply climb. You dominated the stair. Very few can make me say this, but… you have my acknowledgment."</span></p>
<<case "Neutral">>
<p><<print _hostName>> observes calmly. <span class="male">"You are the sole survivor of the stair. The objective is achieved with supreme excellence."</span></p>
<</switch>>
<<set $fame += 60>>
<<set $combatFame += 60>>
<<set $gold += 1200>>
<<set $spiritualRoot += 2>>
</div>
<</widget>>
<<widget "getHeavenlyStairDefeat">>
<<set _hostName to $tournamentHost.name>>
<<set _hostAlign to $tournamentHost.alignment>>
<<set _steps to $hsPlayerStep>>
<<set _rank to $hsPlayerRank>>
<<set _total to $hsTotalClimbers ?? 12>>
<<if _rank lte 3>>
<<set _stage to "final">>
<<elseif _rank lte Math.ceil(_total/2)>>
<<set _stage to "mid">>
<<else>>
<<set _stage to "early">>
<</if>>
<div class="tournament-defeat">
<<if _stage eq "final">>
<h2>🥈 So Close to the Heavens!</h2>
<p>You climbed <<print _steps>> steps, standing among the very best. Only <<if _rank is 2>>one<<else>>two<</if>> climbers went further.</p>
<p>The heavens almost acknowledged you – but not quite.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> offers you a warm nod. <span class="male">"You nearly touched the sky. That is a feat of immense honor. Stand proud."</span></p>
<<case "Demonic">>
<p><<print _hostName>> studies you with keen interest. <span class="male">"So close to perfection. I will remember your hunger… and your near miss."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> smiles, intrigued. <span class="male">"The agony of coming so far and yet falling short… it’s almost delicious. You are still remarkable."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> offers rapid-fire questions. <span class="male">"Your decision-making in the final steps! The marginal deficit! Astonishing data!"</span></p>
<<case "Prideful">>
<p><<print _hostName>> gives a slight, grudging nod. <span class="male">"You were among the final few. That is worth a sliver of my respect."</span></p>
<<case "Neutral">>
<p><<print _hostName>> observes with a rare hint of approval. <span class="male">"Top three is a significant achievement. You did not fail."</span></p>
<</switch>>
<<set $fame += 35>>
<<set $combatFame += 35>>
<<set $gold += 600>>
<<elseif _stage eq "mid">>
<h2>⚡ A Respectable Climb</h2>
<p>You ascended <<print _steps>> steps – better than many, but not the best.</p>
<p>The crowd cheers for your effort; you proved yourself a solid cultivator.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> claps politely. <span class="male">"You persevered. The stair tested you, and you did not falter. Well done."</span></p>
<<case "Demonic">>
<p><<print _hostName>> shrugs, but a flicker of interest remains. <span class="male">"You lasted longer than the rabble. There might be something in you yet."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> gives you an appreciative glance. <span class="male">"Not the pinnacle, but certainly entertaining. I enjoyed watching you struggle."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> nods as they take notes. <span class="male">"A consistent performance. Your step selection was… adequate."</span></p>
<<case "Prideful">>
<p><<print _hostName>> barely acknowledges you. <span class="male">"You did not embarrass yourself."</span></p>
<<case "Neutral">>
<p><<print _hostName>> observes flatly. <span class="male">"You climbed. You fell. You were not last."</span></p>
<</switch>>
<<set $fame += 15>>
<<set $combatFame += 15>>
<<set $gold += 250>>
<<else>>
<h2>💨 The Stair Rejects You</h2>
<p>After only <<print _steps>> steps the pressure shattered your resolve. You tumbled back to the ground, far from the top.</p>
<p>The higher climbers barely noticed your fall. For you, the heavens remain distant.</p>
<<switch _hostAlign>>
<<case "Righteous">>
<p><<print _hostName>> offers a brief, pitying nod. <span class="male">"The Heavenly Stair shows no mercy. Train harder, and perhaps you will climb further."</span></p>
<<case "Demonic">>
<p><<print _hostName>> scoffs. <span class="male">"Pathetic. You broke before even testing the true climb. Go crawl back to the mortal realm."</span></p>
<<case "Hedonistic">>
<p><<print _hostName>> sighs dramatically. <span class="male">"A shame. I expected more drama. You barely entertained me."</span></p>
<<case "Scholarly">>
<p><<print _hostName>> jots a quick note. <span class="male">"Entry‑level failure. Data logged."</span></p>
<<case "Prideful">>
<p><<print _hostName>> doesn’t even look at you. Not worth the glance.</p>
<<case "Neutral">>
<p><<print _hostName>> states simply: <span class="male">"You are not strong enough."</span></p>
<</switch>>
<<set $fame += 5>>
<<set $combatFame += 5>>
<<set $gold += 80>>
<</if>>
<<if $health lte ($maxhealth * 0.2) and $equippedRobe>>
<p>Your robe is shredded, leaving you humiliated as well as defeated.</p>
<</if>>
</div>
<</widget>><div id="casualSexContainer">
<<CasualSex "the shady merchant" "a high-grade recovery potion" "sub" "vaginal" "Tournament|Region1">>
</div>
<<set $health = $maxhealth>><div class="tournament-lobby">
<h2>⚔️ Tournament Board</h2>
<p>Notices and invitations for upcoming tournaments in the region.</p>
<div class="board-description">
<p>Several scrolls and announcements are posted here. Cultivators gather to discuss the latest tournaments and gossip about the hosts.</p>
</div>
<div class="tournament-actions">
<<link "📋 View Tournament Invitation">>
<<if !$tournamentHost>>
<<generateTournamentHost>>
<</if>>
<<goto "TournamentDetails">>
<</link>>
<<link "🔄 Check for New Tournaments">>
<<set $tournamentHost to null>>
<<goto "TournamentBoard">>
<<generateTournamentHost>>
<</link>>
<<link "⬅️ Return to Town" $passage>><</link>>
</div>
</div><<if !$tournamentHost>>
<<generateTournamentHost>>
<</if>>
<div class="tournament-details">
<h2>Tournament Details</h2>
<div class="host-info">
<h3>Hosted by $tournamentHost.title $tournamentHost.name</h3>
<p><strong>Cultivation:</strong> $tournamentHost.realm $tournamentHost.stage</p>
<p><strong>Alignment:</strong> $tournamentHost.alignment</p>
<p><strong>Location:</strong> $tournamentHost.location</p>
<p><strong>Prize Pool:</strong> $tournamentHost.prize spirit stones</p>
</div>
<<getTournamentLocationDescription $tournamentHost.location>>
<div class="format-info">
<h3>Competition Format</h3>
<<getTournamentFormatDescription $tournamentHost.format>>
</div>
<div class="rumor-section">
<h3>⚠️ Local Rumor</h3>
<p><em>"$tournamentHost.rumor"</em></p>
</div>
<div class="tournament-actions">
<<link "📋 Accept Invitation">>
<<goto "TournamentPrep">>
<</link>>
<<link "❌ Decline">>
<<set $tournamentHost to null>>
<<goto "TournamentBoard">>
<</link>>
</div>
</div><div class="tournament-prep">
<h2>Preparing for Tournament</h2>
<p>You make your way to $tournamentHost.location to register for the tournament.</p>
<p>The venue is <<print either("bustling with activity", "surprisingly quiet", "filled with tense energy", "alive with excitement")>>. Various cultivators from different sects and backgrounds have gathered here, sizing each other up.</p>
<<if $tournamentHost.alignment eq "Demonic">>
<p>You notice shady figures in corners, exchanging money and making bets. The air feels thick with danger and greed.</p>
<<elseif $tournamentHost.alignment eq "Hedonistic">>
<p>Servants in fine silks offer refreshments and entertainment. The atmosphere is luxurious, almost decadent. Everything here screams wealth.</p>
<<elseif $tournamentHost.alignment eq "Scholarly">>
<p>Detailed records of past tournaments are displayed on elaborate scrolls. The host's disciples are taking careful notes on each arriving competitor, studying them intently.</p>
<<elseif $tournamentHost.alignment eq "Prideful">>
<p>You see $tournamentHost.name overseeing preparations personally, barking orders at servants and coordinators with obvious disdain. They demand perfection.</p>
<<elseif $tournamentHost.alignment eq "Righteous">>
<p>Order and fairness are paramount here. Referees are briefing all competitors on the rules of honorable combat, ensuring everyone has an equal chance.</p>
<<else>>
<p>The preparations are methodical and efficient, though you can't quite read $tournamentHost.name's intentions.</p>
<</if>>
<div id="prep-options" class="prep-options">
<h3>Before the tournament starts, you have some time:</h3>
<<link "⚔️ Enter the Tournament">>
<<set $tournamentActive to true>>
<<goto "TournamentStart">>
<</link>>
<br>
<<link "🏃 Train Briefly (+1 Martial Arts, -50 stones)">>
<<if $gold >= 50>>
<<set $gold -= 50>>
<<replace "#prep-options">>
<div class="prep-result training-result">
<h3>Training Session</h3>
<p>You find a secluded corner of the venue and begin to practice. Your movements become more fluid, your strikes more precise.</p>
<p>The training invigorates you. You feel more confident in your technique.</p>
<<startStatChanges>>
<<gainStat "Martial Arts" "basemartialArts" 1 1 40>>
<<showStatChanges>>
<p>Now you're ready to enter the tournament.</p>
<br><<link "⚔️ Enter the Tournament">>
<<set $tournamentActive to true>>
<<goto "TournamentStart">>
<</link>>
<br><<link "❌ Back Out">>
<<set $tournamentHost to null>>
<<set $activeTournament to false>>
<<goto "TournamentBoard">>
<</link>>
</div>
<</replace>>
<<else>>
<<replace "#prep-options">>
<div class="prep-result error-result">
<p>You approach the training grounds, but realize you don't have enough spirit stones to pay for instruction.</p>
<p><strong>You need 50 spirit stones but only have $gold.</strong></p>
<br><<link "Continue Preparing">>
<<replace "#prep-options">>
<div class="prep-options">
<h3>Before the tournament starts, you have some time:</h3>
<<link "⚔️ Enter the Tournament">>
<<set $tournamentActive to true>>
<<goto "TournamentStart">>
<</link>>
<br>
<<link "🧘 Meditate (Calm your mind)">>
<<set $tournamentMeditated to true>>
<<replace "#prep-options">>
<div class="prep-result meditation-result">
<h3>Meditation</h3>
<p>You find a quiet corner and sit in peaceful meditation. The sounds of the venue fade away as you focus inward.</p>
<p>Your mind becomes clear. Doubts dissolve. Your spirit feels calm and centered.</p>
<p>You emerge from meditation feeling mentally sharp and ready to face whatever challenges await.</p>
<br><<link "⚔️ Enter the Tournament">>
<<set $tournamentActive to true>>
<<goto "TournamentStart">>
<</link>>
<br><<link "❌ Back Out">>
<<set $tournamentHost to null>>
<<set $activeTournament to false>>
<<goto "TournamentBoard">>
<</link>>
</div>
<</replace>>
<</link>>
<br><<link "❌ Change Your Mind">>
<<set $tournamentHost to null>>
<<set $activeTournament to false>>
<<goto "TournamentBoard">>
<</link>>
</div>
<</replace>>
<</link>>
</div>
<</replace>>
<</if>>
<</link>>
<br>
<<link "🧘 Meditate (Calm your mind)">>
<<set $tournamentMeditated to true>>
<<replace "#prep-options">>
<div class="prep-result meditation-result">
<h3>Meditation</h3>
<p>You find a quiet corner and sit in peaceful meditation. The sounds of the venue fade away as you focus inward.</p>
<p>Your mind becomes clear. Doubts dissolve. Your spirit feels calm and centered.</p>
<p>You emerge from meditation feeling mentally sharp and ready to face whatever challenges await.</p>
<br><<link "⚔️ Enter the Tournament">>
<<set $tournamentActive to true>>
<<goto "TournamentStart">>
<</link>>
<br><<link "❌ Back Out">>
<<set $tournamentHost to null>>
<<set $activeTournament to false>>
<<goto "TournamentBoard">>
<</link>>
</div>
<</replace>>
<</link>>
<br>
<<link "❌ Change Your Mind">>
<<set $tournamentHost to null>>
<<set $activeTournament to false>>
<<goto "TournamentBoard">>
<</link>>
</div>
</div><div class="tournament-start">
<h2>The Tournament Begins!</h2>
<p>The tournament officially begins. Cultivators gather in the arena as the announcer's voice booms across the venue.</p>
<<getTournamentFormatDescription $tournamentHost.format>>
<p>You feel the weight of anticipation in the air. All around you, cultivators are preparing themselves mentally and physically.</p>
<div class="tournament-start-actions">
<<link "⚔️ Begin Tournament" "TournamentBattle|FormatSpecific">>
<<initializeTournamentFormat $tournamentHost.format>>
<</link>>
</div>
</div><<if !$tournamentData or !$tournamentData.format>>
<<initializeTournamentFormat $tournamentHost.format>>
<</if>>
<<set _format to $tournamentHost.format>>
<!-- ═════════════════════════════════════════════════════════════
SINGLE ELIMINATION - 1v1 DUELS
═════════════════════════════════════════════════════════════ -->
<<if _format eq "Martial Elimination">>
<<TournamentMartialElimination>>
<<elseif _format eq "Arena Survival">>
<<TournamentArenaSurvival>>
<<elseif _format eq "Heavenly Stair Challenge">>
<<HeavenlyStairChallenge>>
<<elseif _format eq "Pill Refining Contest">>
<<PillRefiningTournament>>
<<elseif _format eq "Team Tournament">>
<<TournamentTeamElimination>>
<</if>><div class="battle-container">
<<if $pe eq 0>>
/* --- 1. INITIATIVE & AMBUSH (Round 1 Only) --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert">
<h3 class="log-title">⚠️ Ambushed!</h3>
<div class="log-entry">
<i>$currentEnemy.fullname strikes before you can react!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You narrowly evaded!</span><</if>>
</div>
</div>
<<if $health lte 0>><<link "Fall in Battle..." $returnpassage>><<set $playerLost to true>><<unset $battleRound>><</link>><</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title">⚡ Initiative Seized</h3>
<div class="log-entry"><i>Your agility grants you the first strike!</i></div>
</div>
<</if>>
<</if>>
<div class="enemy-presentation">
<h2 class="combat-title">Facing: $currentEnemy.fullname</h2>
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>Martial Stance</h3>
<div class="action-button-container">
<<link "BASIC STRIKE" "Battle">>
<<set $pe to 1>><<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Divine Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Qi: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Qi</span>
<<else>>
<div class="invoke-button-container">
<<link "INVOKE" "Battle">>
<<set $pe = 1>><<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">The Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> attack $currentEnemy.fullname!
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">><<PlayerAttackDamage>>
<<else>><span class="miss-text">Your strike missed!</span><</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
<b>$currentEnemy.fullname</b> retaliates!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">The enemy missed!</span><</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "Victory! Enemy Slain" $returnpassage>>
<<set $battleWon = true>><<set $defeatedEnemy to $currentEnemy>>
<<set $pe = $nextPe>><<unset $battleRound>>
<</link>>
<<elseif $health lte 0>>
<<link "You have been defeated..." $returnpassage>>
<<set $playerLost to true>><<set $pe to $nextPe += 1>>
<<unset $battleRound>>
<</link>>
<<else>>
/* Force return to 'Battle' passage explicitly */
<<link "Continue the Clash" "Battle">>
<<set $pe = 0>><<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><div class="battle-container">
<div class="enemy-presentation">
<div class="EnemyCombat-panel" style="display:flex; flex-direction: row; justify-content: center; align-items: center;">
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
</div>
<<if $pe eq 0>>
/* --- INITIATIVE CHECK (battleround) --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert" style="margin-bottom: 1em;">
<h3 class="log-title" style="color:#ff4c4c;">⚠️ Fast Exchange</h3>
<div class="log-entry">
<i>$currentEnemy.fullname is incredibly swift! They strike before you can finish your salute!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You parried the sudden opening blow!</span><</if>>
</div>
</div>
<<if $health lte 0>>
<div class="battle-resolution">
<<link "Eliminated..." $returnpassage>>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
</div>
<</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title" style="color:#4ade80;">⚡ Tactical Advantage</h3>
<div class="log-entry"><i>Your focus is absolute. You seize the first move of the match!</i></div>
</div>
<</if>>
<</if>>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>General Actions</h3>
<div class="action-button-container">
<<link "ATTACK" "Battle1">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Energy cost: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Not enough energy</span>
<<else>>
<div class="invoke-button-container">
<<link "USE" "Battle1">>
<<set $pe = 1>>
<<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">Battle Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> attempt to hit $currentEnemy.fullname!<br>
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
<span class="miss-text">You missed your attack!</span>
<</if>>
<</if>>
<<if $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
<b>$currentEnemy.fullname</b> attacks you!<br>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
<span class="miss-text">$currentEnemy.fullname missed their attack!</span>
<</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "The enemy is slain! Victory!" $returnpassage>>
<<set $pe = $nextPe>>
<<unset $battleRound>>
<</link>>
<<elseif $health lte 0>>
<<link "You've lost!" $returnpassage>>
<<set $pe = $nextPe + 1>>
<<unset $battleRound>>
<</link>>
<<else>>
<<link "Continue battle" $passage>>
<<set $pe = 0>>
<<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><<set _deathChance to 0>>
<<set _pe to 0>>
<img src="images/Story/death.png" width=70%><<nobr>>
<<if $playerSect == "demonic" and $enemySect == "righteous">>
<<set _deathChance += 30>>
<</if>>
<<if $playerSect == "righteous" and $enemySect == "demonic">>
<<set _deathChance += 30>>
<</if>>
<<if $totalPCdemonicreputation > $totalPCrighteousreputation>>
<<set _deathChance += 20>>
<</if>>
<<if $totalPCrighteousreputation > $totalPCdemonicreputation>>
<<set _deathChance += 10>>
<</if>>
<<set _deathRoll to random(1,100)>>
<<if _deathRoll <= _deathChance>>
<p>Your opponent stands over your fallen body, victory burning in their eyes.</p>
<<if $enemySect == "righteous">>
<p>“For the greater good,” they mutter, raising their blade. The pain is brief… then, silence.</p>
<</if>>
<<if $enemySect == "demonic">>
<p>They sneer. “Too weak to live.” The world fades with their laughter echoing in your ears.</p>
<</if>>
<p>But fate is not so simple. As your soul slips from your body, something stirs — a pull, a fracture in time, a second chance.</p>
<<set $regression += 1>>
<<set $hasRegressed = true>>
<p>You awaken with a gasp, cold sweat clinging to your skin. You’re… alive. But weaker. Back to the moment before it all went wrong.</p>
<<link "..............." $returnpassage>> <<set $regression += 1>>
<<set $hasRegressed = true>><</link>>
<<else>>
<p>You were defeated, but your opponent spares you — for now. You live, but only barely.</p>
<<link "Go away" $returnpassage>><<set $health to 1>><<set $playerEnergy to 0>><</link>><</if>>
<</nobr>><div class="battle-container">
<div class="enemy-presentation">
<div class="EnemyCombat-panel" style="display:flex; flex-direction: row; justify-content: center; align-items: center;">
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
</div>
<<if $pe eq 0>>
/* --- INITIATIVE CHECK (battleround) --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert" style="margin-bottom: 1em;">
<h3 class="log-title" style="color:#ff4c4c;">⚠️ Swift Beast</h3>
<div class="log-entry">
<i>$currentEnemy.fullname lunges before you can react!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You barely dodge the opening strike!</span><</if>>
</div>
</div>
<<if $health lte 0>>
<div class="battle-resolution">
<<link "Eliminated..." "GameOver">>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
</div>
<</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title" style="color:#4ade80;">⚡ Hunting Instinct</h3>
<div class="log-entry"><i>You anticipate the creature's movements and strike first!</i></div>
</div>
<</if>>
<</if>>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>General Actions</h3>
<div class="action-button-container">
<<link "ATTACK" "HuntBeastsBattle|Region1">>
<<set $pe to 1>><<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq true>>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Energy: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Energy</span>
<<else>>
<div class="invoke-button-container">
<<link "USE" "HuntBeastsBattle|Region1">>
<<set $pe = 1>><<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">Hunting Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> attempt to hit the $currentEnemy.fullname!
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
<span class="miss-text">You missed your attack!</span>
<</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
The <b>$currentEnemy.fullname</b> prepares to attack you!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
<span class="miss-text">The $currentEnemy.fullname missed their attack!</span>
<</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<div class="victory-loot-panel" style="margin-bottom: 1em;">
<p style="color:#4ade80;">You feel more experienced after winning against the $currentEnemy.fullname!</p>
<<set _totalWeight = 0>>
<<for _drop range $currentEnemy.enemyLoot>>
<<set _totalWeight += _drop.chance>>
<</for>>
<<set _roll = random(1, _totalWeight)>>
<<set _running = 0>>
<<set $loot = null>>
<<for _drop range $currentEnemy.enemyLoot>>
<<set _running += _drop.chance>>
<<if _roll <= _running>>
<<set $loot = _drop.item>>
<<break>>
<</if>>
<</for>>
<p>You loot the corpse of the <<print $currentEnemy.fullname>> and find: <b><<print $loot.name>></b>.</p>
<<AddItemToInventory $loot>>
</div>
<<link "The enemy is slain! Victory!" $returnpassage>>
<<set $pe = 0>>
<<set $exp = $exp + $currentEnemy.enemyXP>>
<<unset $battleRound>>
<</link>>
<<elseif $health lte 0>>
<<link "You've lost!" "GameOver">>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
<<else>>
<<link "Continue battle" $passage>>
<<set $pe = 0>>
<<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><div class="battle-container">
<div class="enemy-presentation">
<div class="EnemyCombat-panel" style="display:flex; flex-direction: row; justify-content: center; align-items: center;">
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
</div>
<<if $pe eq 0>>
/* --- INITIATIVE & AMBUSH (Round 1 Only) --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert" style="margin-bottom: 1em;">
<h3 class="log-title" style="color:#ff4c4c;">⚠️ Ambushed!</h3>
<div class="log-entry">
<i>$currentEnemy.fullname strikes before you can react!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You narrowly evaded!</span><</if>>
</div>
</div>
<<if $health lte 0>>
<div class="battle-resolution">
<<link "Fall in Battle..." $returnpassage>>
<<set $playerLost to true>><<unset $battleRound>>
<</link>>
</div>
<</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title" style="color:#4ade80;">⚡ Initiative Seized</h3>
<div class="log-entry"><i>Your agility grants you the first strike!</i></div>
</div>
<</if>>
<</if>>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>Martial Stance</h3>
<div class="action-button-container">
<<link "BASIC STRIKE" "MissionBattle1">>
<<set $pe to 1>><<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Divine Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Qi: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Qi</span>
<<else>>
<div class="invoke-button-container">
<<link "INVOKE" "MissionBattle1">>
<<set $pe = 1>><<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">The Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> attack $currentEnemy.fullname!
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">><<PlayerAttackDamage>>
<<else>><span class="miss-text">Your strike missed!</span><</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
<b>$currentEnemy.fullname</b> retaliates!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">The enemy missed!</span><</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "Victory! Enemy Slain" $returnpassage>>
<<set $battleWon = true>><<set $defeatedEnemy to $currentEnemy>>
<<set $pe = $nextPe>><<unset $battleRound>>
<</link>>
<<elseif $health lte 0>>
<<link "You have been defeated..." $returnpassage>>
<<set $playerLost to true>><<set $pe to $nextPe += 1>>
<<unset $battleRound>>
<</link>>
<<else>>
<<link "Continue the Clash" "MissionBattle1">>
<<set $pe = 0>><<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><<nobr>>
<<if $pe eq 0>>
<br>You are fighting $currentEnemy.fullname !
<br><<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<br><b>General Actions</b>:
<br><<link "Attack" "TavernBattle">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<br><<link "Surrender" "TavernBattle">>
<<set $pe to 1>>
<<set $playeraction = "surrender">>
<</link>>
<table class="abilities-table">
<td>
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<br><<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "TavernBattle">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>
<</if>>
<</for>>
</td>
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<br><<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction = "attack success">>
<br><<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
<br>You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<br><<if $enemyaction eq "attack">>The $currentEnemy.fullname attacks you!
<<EnemyAttackAttempt>>
<<if $enemyaction = "attack success">>
<br><<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
<br>The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<br><<Ability $ability>><</Ability>><</if>>
<<if $playeraction eq "surrender">>
<br>You have surrendered. You lost the battle.
<<set $health = 0>>
<</if>>
<br><<if $currentEnemy.NPCcurrenthealth lte 0>><<link "The enemy is defeated! Victory!" $returnpassage>><<set $pe = $nextPe>><</link>>
<br><<elseif $health lte 0>><<link "You've lost...." $returnpassage>><<set $pe = $nextPe += 1>><</link>>
<br><<else>><<link "Continue battle" $passage>><<set $pe = 0>><</link>>
<</if>>
<</if>>
<</nobr>><div class="battle-container">
<div class="enemy-presentation">
<div class="EnemyCombat-panel" style="display:flex; flex-direction: row; justify-content: center; align-items: center;">
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
</div>
<<if $pe eq 0>>
/* --- 1. TOURNAMENT INITIATIVE CHECK --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert" style="margin-bottom: 1em;">
<h3 class="log-title" style="color:#ff4c4c;">⚠️ Fast Exchange</h3>
<div class="log-entry">
<i>$currentEnemy.fullname is incredibly swift! They strike before you can finish your salute!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You parried the sudden opening blow!</span><</if>>
</div>
</div>
<<if $health lte 0>>
<div class="battle-resolution">
<<link "Eliminated from the Tournament..." "Tournament|Region1">>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
</div>
<</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title" style="color:#4ade80;">⚡ Tactical Advantage</h3>
<div class="log-entry"><i>Your focus is absolute. You seize the first move of the match!</i></div>
</div>
<</if>>
<</if>>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>Martial Stance</h3>
<div class="action-button-container">
<<link "BASIC STRIKE" "TournamentBattle:Martial Elimination">>
<<set $pe to 1>><<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Divine Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Qi: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Qi</span>
<<else>>
<div class="invoke-button-container">
<<link "INVOKE" "TournamentBattle:Martial Elimination">>
<<set $pe = 1>><<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">Tournament Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> strike at $currentEnemy.fullname!
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">><<PlayerAttackDamage>>
<<else>><span class="miss-text">Your opponent deftly evaded!</span><</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
<b>$currentEnemy.fullname</b> retaliates!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You parried the counter-attack!</span><</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<if $tournamentData.round lt 4>>
<p>You advance to the next round!</p>
<<link "Victory! You've advanced!" $returnpassage>>
<<set $pe = 0>>
<<unset $battleRound>>
<<set $tournamentData.wins += 1>>
<<set $tournamentData.round += 1>>
<</link>>
<<else>>
<p>You've won the championship!</p>
<<link "Victory! You've advanced!" $returnpassage>>
<<unset $battleRound>>
<<set $tournamentData.wins += 1>>
<<set $pe to 6>>
<</link>>
<</if>>
<<elseif $health lte 0>>
<<link "Defeat! Eliminated" $returnpassage>>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
<<else>>
<<link "Continue the Match" "TournamentBattle:Martial Elimination">>
<<set $pe = 0>><<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div>
<!--======================TEAM TOURNAMENT======================================== --><div class="battle-container">
<div style="display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 15px; width: 100%;">
<div style="flex: 1;">
<h3 style="text-align: center; color: #074e23; font-family: 'Cinzel Decorative', serif;">Your Team</h3>
<<AllyGroupBattleTable>>
</div>
<div style="flex: 1;">
<h3 style="text-align: center; color: #660000; font-family: 'Cinzel Decorative', serif;">Enemy Team</h3>
<<EnemyGroupBattleTable>>
</div>
</div>
<<if $pe eq 0>>
/* --- 1. TOURNAMENT INITIALIZATION --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<</if>>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>Martial Stance</h3>
<div class="action-button-container">
<<for _i to 0; _i lt $enemyTeam.length; _i++>>
<<if $enemyTeam[_i].NPCcurrenthealth gt 0>>
<<capture _i>>
<<link "BASIC STRIKE at <<print $enemyTeam[_i].fullname>>">>
<<set $playerTargetIdx = _i>>
<<set $playeraction = "attack">>
<<set $pe = 1>>
<<goto "TournamentBattle:Team Elimination">>
<</link>><br>
<</capture>>
<</if>>
<</for>>
</div>
</div>
<div class="action-column">
<h3>Divine Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Qi: <<print $skillInventory[_i].energy>></span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Qi</span>
<<else>>
<<link "INVOKE">>
<<set $playerTargetIdx = 0>>
<<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<<set $pe = 1>>
<<goto "TournamentBattle:Team Elimination">>
<</link>>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">⚔️ Team Combat Exchange - Round <<print $battleRound>></h3>
<!-- PLAYER TURN -->
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> strike at <<print $enemyTeam[$playerTargetIdx].fullname>>!
<<PlayerTeamAttackAttempt>>
<<if $playeraction eq "attack success">>
<<PlayerTeamAttackDamage>>
<<else>>
<span class="miss-text">Your opponent deftly evaded!</span>
<</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<!-- ALLIES AUTO-ATTACK -->
<div class="log-entry ally-turn">
<b>Your Allies Counter:</b><br>
<<for _allyIdx to 0; _allyIdx lt $allyTeam.length; _allyIdx++>>
<<if $allyTeam[_allyIdx].NPCcurrenthealth gt 0>>
<!-- Ally picks random alive enemy -->
<<set _aliveEnemies = []>>
<<for _e to 0; _e lt $enemyTeam.length; _e++>>
<<if $enemyTeam[_e].NPCcurrenthealth gt 0>>
<<set _aliveEnemies.push(_e)>>
<</if>>
<</for>>
<<if _aliveEnemies.length gt 0>>
<<set _allyTargetIdx = _aliveEnemies[Math.floor(Math.random() * _aliveEnemies.length)]>>
<p style="margin: 5px 0;"><b><<print $allyTeam[_allyIdx].fullname>></b> attacks <<print $enemyTeam[_allyTargetIdx].fullname>>!</p>
<<AllyAttackAttempt $allyTeam[_allyIdx] $enemyTeam[_allyTargetIdx]>>
<<if $allyaction eq "attack success">>
<<AllyAttackDamage $allyTeam[_allyIdx] $enemyTeam[_allyTargetIdx]>>
<<else>>
<span class="miss-text">The attack is evaded!</span>
<</if>>
<</if>>
<</if>>
<</for>>
</div>
<hr class="combat-divider">
<!-- ENEMIES AUTO-ATTACK -->
<div class="log-entry enemy-turn">
<b>Enemy Counter-Attack:</b><br>
<<for _enemyIdx to 0; _enemyIdx lt $enemyTeam.length; _enemyIdx++>>
<<if $enemyTeam[_enemyIdx].NPCcurrenthealth gt 0>>
<!-- Enemy picks random alive target (60% player, 40% ally) -->
<<set _aliveAllies = []>>
<<for _a to 0; _a lt $allyTeam.length; _a++>>
<<if $allyTeam[_a].NPCcurrenthealth gt 0>>
<<set _aliveAllies.push(_a)>>
<</if>>
<</for>>
<<set _targetChoice = random(1, 100)>>
<<if _aliveAllies.length eq 0 or _targetChoice lte 60>>
<!-- ATTACK PLAYER -->
<p style="margin: 5px 0;"><b><<print $enemyTeam[_enemyIdx].fullname>></b> attacks you!</p>
<<EnemyTeamAttackAttempt $enemyTeam[_enemyIdx] {NPCagility: $agility, NPCdef: $def} true>>
<<if $enemyaction eq "attack success">>
<<EnemyTeamAttackDamage $enemyTeam[_enemyIdx] {NPCagility: $agility, NPCdef: $def} true>>
<<else>>
<span class="miss-text">You parried the attack!</span>
<</if>>
<<else>>
<!-- ATTACK RANDOM ALLY -->
<<set _targetAllyIdx = _aliveAllies[Math.floor(Math.random() * _aliveAllies.length)]>>
<p style="margin: 5px 0;"><b><<print $enemyTeam[_enemyIdx].fullname>></b> attacks <<print $allyTeam[_targetAllyIdx].fullname>>!</p>
<<EnemyTeamAttackAttempt $enemyTeam[_enemyIdx] $allyTeam[_targetAllyIdx] false>>
<<if $enemyaction eq "attack success">>
<<EnemyTeamAttackDamage $enemyTeam[_enemyIdx] $allyTeam[_targetAllyIdx] false>>
<<else>>
<span class="miss-text">The ally parried the attack!</span>
<</if>>
<</if>>
<</if>>
<</for>>
</div>
<!-- BATTLE RESOLUTION -->
<div class="battle-resolution">
<<set _enemyAlive = 0>>
<<set _playerAlive = ($health gt 0) ? 1 : 0>>
<<set _allyAlive = 0>>
<<for _i to 0; _i lt $enemyTeam.length; _i++>>
<<if $enemyTeam[_i].NPCcurrenthealth gt 0>>
<<set _enemyAlive += 1>>
<</if>>
<</for>>
<<for _i to 0; _i lt $allyTeam.length; _i++>>
<<if $allyTeam[_i].NPCcurrenthealth gt 0>>
<<set _allyAlive += 1>>
<</if>>
<</for>>
<!-- VICTORY -->
<<if _enemyAlive eq 0>>
<<if $tournamentData.round lt 4>>
<p>You advance to the next round!</p>
<<link "Victory! You've advanced!" $returnpassage>>
<<unset $battleRound>>
<<set $tournamentData.wins += 1>>
<<set $tournamentData.round += 1>>
<<set $enemyTeam = null>>
<<unset $enemyAlly1>>
<<unset $enemyAlly2>>
<<unset $enemyAlly3>>
<<unset $enemyAlly4>>
<</link>>
<<else>>
<p>You've won the championship!</p>
<<link "Victory! You've advanced!" $returnpassage>>
<<unset $battleRound>>
<<set $tournamentData.wins += 1>>
<<set $pe to 6>>
<</link>>
<</if>>
<!-- DEFEAT - Player dead and no allies -->
<<elseif $health lte 0 and _allyAlive eq 0>>
<p style="color: #ff4444; font-weight: bold;">Your team has been eliminated!</p>
<<link "Defeat! Eliminated from Tournament" $returnpassage>>
<<set $pe = "lost">>
<<unset $battleRound>>
<</link>>
<!-- CONTINUE BATTLE -->
<<else>>
<<link "Continue the Match">>
<<set $pe = 0>>
<<set $battleRound++>>
<<unset $playerTargetIdx>>
<<unset $playeraction>>
<<goto "TournamentBattle:Team Elimination">>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><<if $regioneventid eq "reg_1">>
<!--The Bamboo Grove of Whispers -->
<<if $pe eq 0>>
The grove is hushed, save for the sigh of bamboo swaying like an endless sea—thousands upon thousands of stalks bending and straightening in a rhythm that feels almost like breathing. The air itself seems ancient here, layered with centuries of spiritual accumulation. Yet beneath the rustle, whispers slither through the leaves—too deliberate, too purposeful to be mere wind.
They curl around your thoughts like living things, beckoning you deeper into the green darkness… or tempting you to open your spirit to them, to hear what voices from beyond the veil wish to impart.
<br>[[Follow the whispers->NormalEvents][$pe=1]]
<br>[[Meditate within the grove ->NormalEvents][$pe=2]]
<br><<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>>
<<WhisperingShade>>
<<BeforeBattle>>
You follow the eerie voices deeper into the grove, drawn by something you cannot name. The air thickens until each breath feels substantial, as if you're inhaling the spiritual essence of the place itself. Qi gathers here, coalescing in ways that defy natural law.
A ghostly cultivator steps from the shadows—or perhaps the shadows step back to reveal what was always there. His form flickers like candlelight, neither fully present nor entirely absent. His eyes are hollow but fierce, burning with an ancient rage that transcends death itself. He wears robes from an era long forgotten, their embroidery faded by centuries. His silence is more eloquent than any scream—it speaks of grudges nursed across lifetimes, of promises broken, of cultivation paths severed before their natural conclusion.
You must fight for the whispers to fade. This shade will not rest while you draw breath in his domain.
<br><<link "Draw your weapon and prepare to fight" "Battle1">><<set $returnpassage to passage()>><<set $passage to "Battle1">><<set $pe to 0>><<set $nextPe to 3>><</link>>
<br><<link "Retreat" $passage>><</link>>
<<elseif $pe eq 2>>
You cross your legs beneath the whispering bamboo, shutting your eyes and sinking into a state between waking and dreaming. Your breathing slows, your heartbeat becomes the drum that marks time in this place.
The voices seep into your mind—at first a storm of incomprehensible nonsense, the babbling of a thousand mouths speaking in tongues long dead. But gradually, gradually, threads of meaning reveal themselves like gold drawn from sand. Forgotten teachings crystallize in your consciousness. Lost sutras that were burned from the world's libraries suddenly make perfect sense. Riddles of mortality and transcendence whisper their answers, tantalizing and profound.
Your qi flows steadier, like a river that had been dammed for centuries, now finding its true course once more. The blockages in your spirit dissolve. When you finally open your eyes and rise to your feet, the grove feels less haunting—more like a sanctuary, even. Yet a lingering sense of being watched trails behind you as you stand, as if the whispers are following, content for now to wait.
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 0 40 "Insight">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>><</link>>
<<elseif $pe eq 3>>
The ghostly cultivator lets out a silent wail as your strike severs his form—a sound that has no sound, but that echoes in your mind nonetheless. He dissolves into threads of light that scatter among the bamboo like fireflies fleeing the dawn, and the whispers at last fall utterly, achingly silent.
The grove exhales. The weight that pressed against your spirit lifts.
Among the fading motes of spiritual energy, you find a shard of jade—no bigger than your thumb—etched with runes of exquisite complexity. It hums faintly with residual power, as if the cultivator's essence has been preserved within it, suspended between life and death, trapped and waiting.
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 0 40 "Insight">>
<br><<showStatChanges>>
<br><<link "Leave the grove" "Map|Region1">><</link>>
<<elseif $pe eq 4>>
The shade's blade pierces your defenses with contemptuous ease—what good are the techniques of the living against an opponent who has already transcended death? Its cold touch drags at your very soul, as if it seeks to drag you down into the abyss with it. The bamboo leans closer, its stalks rustling with something that sounds disturbingly like laughter, and the whispers transform into accusations—your failures, your weaknesses, every moment you have disappointed yourself.
With the last of your will, you stagger free from the grove, your robes torn, your qi depleted. Though you live, though you escaped, your qi feels frayed and tainted by lingering resentment—the shade's final curse, a poison that will take days to purge.
<br><<link "Stumble away from the grove" "Map|Region1">><</link>>
<</if>>
<<elseif $regioneventid eq "reg_2">>
<<if $pe eq 0>>
<!-- The Crying Lotus-->
<img src="images/Story/bloodlotus.jpg" width=512>
A lotus blooms in the middle of a bloodied pond—impossible, terrible, beautiful. Its petals are the color of fresh wounds, a crimson so vivid it seems to pulse with supernatural life. The stalk is black as obsidian, and from its heart drips a single crystalline tear that hangs suspended as if time itself has paused around it. The tear never falls; it simply hovers, weeping eternal sorrow.
The pond itself reeks of tragedy. The water is murky with old blood, yet somehow the lotus remains pristine, untainted—as if beauty and horror have reached an eternal stalemate in this place. Whispers drift across the surface of the water—prayers? Curses? The anguished cries of the dead? You cannot tell. The boundary between divine and profane has blurred here.
This lotus should not exist. Yet it does.
<br>[[Touch the lotus->NormalEvents][$pe=1]]
<br>[[Sing to the lotus ->NormalEvents][$pe=2]]
<br><<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>>
You reach out and touch the tear. The moment your finger makes contact, it shatters like glass—but the sensation that follows is anything but sharp.
The liquid heat rolls onto your skin, searing like molten metal, hot enough to blister. Yet simultaneously it feels like ice water, freezing your veins, your blood, your very essence. Pain and numbness war within you as you stagger backward, crying out.
For a moment—just a moment—your vision cracks open and you see beyond the veil. Endless rivers of blood. Battlefields where flowers like this one bloom from consecrated ground. Empires built on the corpses of cultivators more powerful than you can imagine. Wars fought over a single petal, a single seed, because this lotus grants clarity—true spiritual insight that comes only from witnessing catastrophe.
When your vision finally clears, you find yourself on your knees at the pond's edge. Your hand trembles as you reach down to find a seed—the Iron-Blood Lotus Seed—still warm from the tear, pulsing with ancient power.
Your soul feels steadier now. Tempered by what you have witnessed. Less vulnerable to deceit, to illusion, to the tricks that demons and spirits love to play on the innocent.
<br><<startStatChanges>>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 2 0 40 "Spiritual Root">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>><</link>>
<br><<AddItemToInventory $ironbloodlotusseed>>
<<elseif $pe eq 2>>
You begin to hum—a gentle melody, something ancient and soothing, a lullaby that mothers once sang to calm children terrified of the dark. The melody flows from you like silk unrolling, and something extraordinary happens.
The blood-stained pond begins to still. The frantic whispers that plagued the air fade into silence. The lotus itself tilts toward you, as if responding to the beauty of your song. The suspended tear—that crystalline jewel that has hung in eternal suspension—finally condenses and falls, landing gently in your outstretched palm.
It shimmers with purity and potential, untouched by the corruption that surrounds it. You can see it, practically feel it: this seed contains secrets that alchemists would kill for. With this, you could create medicines that transcend mortal understanding. Cultivation pills that breach barriers thought unbreachable. The very essence of enlightenment, distilled and waiting.
Your insight deepens as you hold it. The music has opened channels in your mind that were previously sealed.
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 0 40 "Insight">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>><</link>>
<br><<AddItemToInventory $ironbloodlotusseed>>
<</if>>
<<elseif $regioneventid eq "reg_3">>
<<if $pe eq 0>>
Amid shattered stone and mossy ruins, you find a jug half-buried in earth.
The seal is old, the clay cracked, yet from within drifts a fragrance so potent it bends your knees. It is wine of the heavens, once brewed by a hand that defied mortality.
<br>[[Drink->NormalEvents][$pe=1]]
<br>[[Save it ->NormalEvents][$pe=2]]
<br><<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>>
The wine is wild fire and starlight. Your body stumbles, your laugh escapes unbidden. Power surges, unbalanced and fierce. You may fall, or you may ascend-only fate decides tonight.
<<set _roll to random(0,100)>>
<<if _roll gte 70>>
You've failed to grasp essence of power!
Your experience has slightly decreased!
<<set $exp -= 0.1*$exp>>
<<else>>
You've succeeded!
You've grasped essence of power! Your experience has increased slightly!
<br><<startStatChanges>>
<br><<gainExp 150 700>>
<br><<showStatChanges>>
<</if>>
<br><<link "Leave" $passage>><</link>>
<<elseif $pe eq 2>>
With iron will, you force the jug's scent from your lungs and reseal it. The fragrance lingers like celestial music, promising strength when fate grows cruel.
Legends whisper that this wine tempers tribulation fire-what is calamity to one who laughs at the heavens?
<br><<link "Leave" $passage>><</link>>
<br><<AddItemToInventory $moltengolddew>>
<</if>>
<<elseif $regioneventid eq "reg_4">>
<<if $pe is 0>>
A monstrous figure blocks your path-a humanoid pig, tusks curling, bristling with muscle and raw energy.
Its gaze fixes on you like a predator sizing prey.
<!-- Demon Pig's Trial -->
<<if $demon_pig_encountered neq 1>>
<br><<link "Fight it" "NormalEvents">><<set $pe = 1>><</link>>
<br><<link "Offer food" "NormalEvents">><<set $pe = 2>><</link>>
<br><<link "Try to appease it" "NormalEvents">><<set $pe = 3>><</link>>
<<else>>
<<if $demon_pig_result eq "fight">>
The demon pig grunts, eyes narrowing as it recognizes you. It steps aside, acknowledging your strength.
<br><<link "Leave silently" $passage>><</link>>
<<elseif $demon_pig_result eq "food">>
The demon pig grunts in recognition, stepping aside to let you pass. It seems to remember your kindness.
<br><<link "Leave silently" $passage>><</link>>
<<elseif $demon_pig_result eq "appease">>
<br>It lunges before you can flee. Its tusks press into your shoulders as massive hands grip your hips.
<br><span class="male">"Did you miss me?"</span> its growl seems to echo in your mind. Its cock slams into your cunt before you can react, shoving you to the ground in doggy style.
<br>You gasp and whimper as it thrusts relentlessly, each grunt pounding your cunt harder than the last. Pain and pleasure collide, your body betraying your hesitation.
<br>Cum rushes hot, thick, helplessly from your pussy as the beast groans and fills you again.
<br><<set _random to random(1,3)>><<if _random eq 1>><img src="images/Sex/demonpig.webp" class="nsfw-glow"><<elseif _random eq 2>><img src="images/Sex/demonpig1.webp" class="nsfw-glow"><<elseif _random eq 3>><img src="images/Sex/demonpig2.webp" class="nsfw-glow"><<set $monsterSexCount += 1>><</if>>
<br>You've been slightly corrupted by demonic energy!
<br><<set $health -= 0.1*$basemaxhealth>>
<br><<startStatChanges>>
<br><<gainExp 50 150>>
<br><<gainStat "luck" "baseluck" 1 0 40 "Luck">>
<br><<gainStat "corruption" "corruption" 3 0 100 "Corruption">>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 3 999 "Demonic Reputation">>
<br><<gainStat "sexFame" "sexFame" 1 3 999 "Fame">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>>
<<set $demon_pig_encountered to 1>>
<<set $demon_pig_result to "appease">>
<</link>>
<</if>>
<</if>>
<<elseif $pe eq 1>>
The pig charges with astonishing speed. Its tusks gleam with malevolent energy, and you clash, qi against brute muscle.
<br>Victory smells of sweat, blood… and sizzling pork.
<br>Demon pig runs away, badly wounded.
<br><<set $health -= 0.1*$basemaxhealth>>
<br><<startStatChanges>>
<br><<gainExp 250>>
<br><<gainStat "luck" "baseluck" 1 0 40 "Luck">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>>
<<set $demon_pig_encountered to 1>>
<<set $demon_pig_result to "fight">>
<</link>>
<<elseif $pe eq 2>>
You offer a steamed bun with shaking hands.
<br>The pig snorts, eyes bright, and devours it. Its gaze softens for a moment, then it grunts, stepping aside.
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 0 40 "Insight">>
<br><<gainStat "luck" "baseluck" 1 0 40 "Luck">>
<br><<gainExp 150 210>>
<br><<showStatChanges>>
<br><<link "Leave" $passage>>
<<set $demon_pig_encountered to 1>>
<<set $demon_pig_result to "food">>
<</link>>
<<elseif $pe eq 3>>
The pig stands before you, towering and impossibly muscular, its nostrils flaring as it studies you like prey.
A guttural growl rumbles from deep within its chest. You step back instinctively, but the beast's sheer weight and speed leave no room for evasion. Its hands close around your shoulders, shoving you forward.
<br>
<br>You stumble onto your hands and knees, the cold, damp forest floor pressing against your skin. The pig looms behind, tusks glinting, eyes burning with unrestrained hunger. Your protests are muffled by the raw force of its dominance; every movement it makes is deliberate, claiming, powerful.
<br>
<br>Before you can react, it presses its thick, muscled body against yours. Your legs wobble, trapped. Its snout nuzzles your neck, hot breath brushing your ear, and you feel it press its massive cock against your cunt.
<br><<linkreplace "Continue">>
<<set _random to random(1,3)>><<if _random eq 1>><img src="images/Sex/demonpig.webp" class="nsfw-glow"><<elseif _random eq 2>><img src="images/Sex/demonpig1.webp" class="nsfw-glow"><<elseif _random eq 3>><img src="images/Sex/demonpig2.webp" class="nsfw-glow"><</if>>
<br>Hands-calloused, strong, impossible-grip your hips, shoving you onto all fours. You gasp, but it doesn't stop. Each thrust drags your pussy across the dirt, every grunt from the beast vibrating through your cunt. You try to pull away, but its hold is relentless.
<br>Its rutting grows rougher, tusks grazing your shoulders, cock pounding your cunt with brutal force. You whimper, shiver, cry out, and hate how your cunt clenches around it anyway, soaking the earth.
<br>You are pushed into the ground, your back arching as it drives deep and fast. Its cum hits your cunt hard, thick and hot, leaving you trembling, soaked, gasping. Your own climax tears through you, helpless, overwhelmed, cunt quivering as it empties itself inside you.
<br>The Demon Pig finally steps back, snorting, leaving you bruised, sticky, cunt sore, trembling on the dirt. Humiliation mixes with heat as you clutch your ruined clothes and your quivering pussy, heart racing from the force of it.
<br>You've been slightly corrupted by demonic energy!
<br>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Demon Pig">><<set $monsterSexCount += 1>>
<br><span class="red">You lost your virginity to $virginityLost!</span>
<</if>>
<br><<set $health -= 0.1*$basemaxhealth>>
<br><<startStatChanges>>
<br><<gainExp 150 210>>
<br><<gainStat "luck" "baseluck" 1 0 40 "Luck">>
<br><<gainStat "corruption" "corruption" 3 0 40 "Corruption">>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 3 999 "Demonic Reputation">>
<br><<gainStat "sexFame" "sexFame" 1 3 999 "Fame">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>>
<<set $demon_pig_encountered to 1>>
<<set $demon_pig_result to "appease">>
<</link>>
<</linkreplace>>
<</if>>
<<elseif $regioneventid eq "reg_5">>
<<if $pe is 0>>
A fox-woman emerges from the mist, her many tails swaying hypnotically. Her crimson eyes fix on you with ancient hunger, lips curling into a knowing smile. She wears silk robes that cling to her curves, and there's something intoxicating about her presence—old magic, predatory grace.
<br><span class="female">"Well, well... what do we have here?"</span> Her voice drips with amusement. <span class="female">"A cultivator, lost in my forest?"</span>
<!-- Fox-Woman's Encounter -->
<<if $fox_woman_encountered neq 1>>
<br><<link "Try to seduce her" "NormalEvents">><<set $pe = 1>><</link>>
<br><<link "Challenge her to combat" "NormalEvents">><<set $pe = 2>><</link>>
<br><<link "Refuse and leave" "NormalEvents">><<set $pe = 3>><</link>>
<<else>>
<<if $fox_woman_result eq "seduce">>
The fox-woman's eyes gleam with recognition and amusement. She circles you slowly, tails brushing against your skin.
<br><span class="female">"Come back for more, have we?"</span> Her laugh is musical, dangerous.
<br><<link "Leave silently" $passage>><</link>>
<<elseif $fox_woman_result eq "fight">>
The fox-woman's expression hardens as she recognizes you. Despite the scar on her arm, respect flickers in her eyes.
<br><span class="female">"You again. Still arrogant enough to challenge me?"</span>
<br><<link "Leave silently" $passage>><</link>>
<<elseif $fox_woman_result eq "refuse">>
The fox-woman watches you approach with contempt written across her perfect face.
<br><span class="female">"Still running away, I see."</span> She turns away, dismissing you entirely.
<br><<link "Leave silently" $passage>><</link>>
<</if>>
<</if>>
<<elseif $pe eq 1>>
You step forward, meeting her gaze directly. Your cultivation is strong enough—you might be able to match her energy.
<br><span class="female">"Interesting..."</span> she purrs, watching you approach. <span class="female">"I can taste your desire from here."</span>
<br>She closes the distance between you, her movements fluid as water. Before you can speak, her clawed hand traces your cheek, and you feel the weight of her ancient power pressing against your mind—seductive, intoxicating, almost suffocating.
<br><span class="female">"Let me show you what a thousand years of experience feels like,"</span> she whispers.
<br><<linkreplace "Continue">>
<<set _random to random(1,3)>><<if _random eq 1>><img src="images/Sex/foxwoman.webp" class="nsfw-glow"><<elseif _random eq 2>><img src="images/Sex/foxwoman1.webp" class="nsfw-glow"><<elseif _random eq 3>><img src="images/Sex/foxwoman2.webp" class="nsfw-glow"><</if>>
<br>She pushes you against a tree, silk robes falling away. Her tails wrap around your body, soft fur contrasting with the urgency of her touch. Your clothes tear as she pulls you close, her mouth finding your neck, her teeth grazing your skin just hard enough to hurt.
<br>Her fingers slip inside you with practiced precision. <span class="female">"So wet already..."</span> she coos mockingly. <span class="female">"I wonder how many times I can make you come before you beg me to stop."</span>
<br>You moan as she works you expertly, her centuries of experience evident in every touch. She positions herself between your legs, and you feel her cock—hard, pressing against your entrance. When she thrusts, it's with a mix of tenderness and raw power that leaves you gasping.
<br>Her tails stroke your body as she moves inside you, deeper, faster, hitting that spot that makes your vision blur. You orgasm around her, and she doesn't slow—she intensifies, chasing her own release with animalistic hunger.
<br>When she comes, it's with a sound that's almost a roar. Her cum fills you, hot and thick, and you climax again, your body trembling beneath her. She holds you close afterward, surprisingly gentle, kissing your forehead like a lover rather than a predator.
<br><span class="female">"You'll do nicely,"</span> she whispers. <span class="female">"Come find me again when you need reminding of what true pleasure feels like."</span>
<br>You've been corrupted by fox-spirit magic!
<br><<set $health += 0.05*$basemaxhealth>>
<br><<startStatChanges>>
<br><<gainExp 120 180>>
<br><<gainStat "depravity" "depravity" 2 0 100 "Depravity">>
<br><<gainStat "corruption" "corruption" 2 0 100 "Corruption">>
<br><<gainStat "charm" "basecharm" 1 0 40 "Charm">>
<br><<gainStat "sexFame" "sexFame" 2 3 999 "Sex Fame">>
<br><<showStatChanges>>
<br><<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Fox-Woman">>
<<set $monsterSexCount += 1>>
<br><span class="red">You lost your virginity to the $virginityLost!</span>
<</if>>
<br><<link "Leave" $passage>>
<<set $fox_woman_encountered to 1>>
<<set $fox_woman_result to "seduce">>
<</link>>
<</linkreplace>>
<<elseif $pe eq 2>>
You narrow your eyes and assume a fighting stance. The fox-woman's expression shifts—surprise, then dark amusement.
<br><span class="female">"Oh, how delightful! A mortal dares challenge me?"</span> She laughs, a sound like silver bells mixed with a predator's growl.
<br>The battle is fierce. Her tails lash out like serpents, each one crackling with fox-fire. You dodge, counterattack, channel your Qi. For a moment, you think you might have her—but she's ancient, cunning, powerful beyond measure.
<br>In the end, you emerge victorious, though barely. She's wounded, breathing hard, eyes blazing with respect and fury.
<br><span class="female">"Well fought, little cultivator. Few have the spine to stand against me."</span> She retreats into the mist, leaving trails of silver-blue light.
<br><<set $health -= 0.15*$basemaxhealth>>
<br><<startStatChanges>>
<br><<gainExp 300>>
<br><<gainStat "martialArts" "basemartialArts" 2 0 40 "Martial Arts">>
<br><<gainStat "strength" "basestrength" 1 0 40 "Strength">>
<br><<gainStat "righteousFame" "righteousFame" 1 3 999 "Righteous Fame">>
<br><<showStatChanges>>
<br><<link "Leave" $passage>>
<<set $fox_woman_encountered to 1>>
<<set $fox_woman_result to "fight">>
<</link>>
<<elseif $pe eq 3>>
You take a step back, shaking your head firmly. <span class="player">"I have no business with you, spirit."</span>
<br>The fox-woman's expression darkens. Her tails snap like whips, and the air grows cold.
<br><span class="female">"Rejecting me? How... insulting."</span> Her voice drips with venom. <span class="female">"Very well. Run along, little cultivator. But know this—I don't forget those who slight me."</span>
<br>She turns away, dismissing you. You feel her ancient eyes boring into your back as you walk away, and a chill runs down your spine. You made an enemy today.
<br><<startStatChanges>>
<br><<gainExp 30>>
<br><<gainStat "luck" "baseluck" 1 0 40 "Luck">>
<br><<showStatChanges>>
<br><<link "Leave quickly" $passage>>
<<set $fox_woman_encountered to 1>>
<<set $fox_woman_result to "refuse">>
<</link>>
<</if>>
<<elseif $regioneventid eq "reg_6">>
<<if $pe eq 0>>
<!-- The Broken Bell Tower-->
At the edge of a forgotten temple stands a tower of splintered wood and rusted bronze.
The wind sighs through the cracks, and with every gust, the great bell groans-a ghost of a tone that once commanded armies of faith.
Carved on the foundation are the words: <b>"Let the faithful awaken; let the unworthy tremble."</b>
Dust dances in the half-light. You feel the weight of countless forgotten prayers pressing on your chest.
<br>[[Ring the bell->NormalEvents][$pe=1]]
<br>[[Climb the tower ->NormalEvents][$pe=2]]
<br><<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>> <!-- Ring the bell -->
You grip the old rope. The bell groans as you pull-its hollow note vibrates through your bones, stirring echoes of ancient voices.
A shimmer spreads from the ground, coalescing into the shape of a spectral monk. His lips move, but no sound escapes-only the resonance of peace.
He bows once, and the air calms. Where he stood, a faint crystal hums with rhythm and clarity.
<br><<AddItemToInventory $brightmeridiancrystal>>
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 0 40 "Insight">>
<br><<gainStat "PCrighteousreputation" "PCrighteousreputation" 1 0 999 "Righteous Reputation">>
<br><<showStatChanges>>
<br><<link "Step away from the tower" $passage>><</link>>
<<elseif $pe eq 2>> <!-- Climb the tower -->
You climb carefully; the wooden steps creak beneath your weight. Dust swirls in the dim light filtering through broken beams.
At the top, the bell's fracture gleams faintly under moonlight. Beneath it lies a set of folded prayer scrolls and a small pouch, sealed with dried wax.
Inside is a pinch of fine, silvery dust that glows when exposed to your breath- Meditation Dust, used by ancient cultivators to focus during breakthroughs.
<br><<AddItemToInventory $meditationdust>>
<br><<startStatChanges>>
<br><<gainStat "basewillpower" "basewillpower" 1 0 40 "Willpower">>
<br><<showStatChanges>>
<br><<link "Descend quietly" $passage>><</link>>
<</if>>
<<elseif $regioneventid eq "reg_7">>
<<if $pe eq 0>>
<!-- The Snake and the Egg-->
Deep in the marshlands, fog swirls over black water. A low hiss cuts through the reeds.
A colossal serpent coils protectively around a single, pulsing egg-its scales shimmer like living jade, its eyes bright with wary intelligence.
Each breath it takes steams the air. You feel a flicker of ancient qi-this creature is not merely a beast, but a guardian.
<br>[[Approach the serpent peacefully->NormalEvents][$pe=1]]
<br>[[Attempt to steal the egg->NormalEvents][$pe=2]]
<br>[[Watch from afar ->NormalEvents][$pe=3]]
<br><<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>> <!-- Peaceful approach -->
You kneel and channel calm qi through your palms, lowering your head.
The serpent watches you closely, muscles tensed to strike-then relaxes slightly as your aura harmonizes with its own.
It flicks its tongue, tasting your sincerity. A low hum vibrates through the marsh, and it sheds a single scale before slithering away into the mist.
<br><<AddItemToInventory $serpentpulsesalve>>
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 0 40 "Insight">>
<br><<gainStat "PCrighteousreputation" "PCrighteousreputation" 1 0 999 "Righteous Reputation">>
<br><<showStatChanges>>
<br><<link "Leave the marsh" $passage>><</link>>
<<elseif $pe eq 2>><!-- Attempt to steal the egg -->
You dart forward, qi blazing—a desperate gambit that echoes through the marsh like a struck bell. Your fingers close around the slick shell, still warm from the serpent's coils, and for just a moment you think you might succeed.
Then the world becomes sound and fury.
The serpent's roar splits the silence like a celestial blade through silk. It reverberates through your bones, through the very water beneath your feet. The creature's ancient eyes flash with an intelligence that transcends mere animal rage—this is the wrath of something that has guarded its young for centuries, perhaps longer.
It lashes out with preternatural speed. Fangs the length of daggers arc toward you, venom dripping from their tips like liquid jade turned toxic. You barely raise your defense, qi crystallizing into a shield, but the impact sends you skidding backward through the marsh water.
Fangs graze your arm—a shallow cut, but the venom is no mortal poison. It sears your veins like molten silver, burning its way up your shoulder. You grit your teeth against the pain and clutch the egg, stumbling toward the marsh's edge.
You manage to escape with the egg—but at a cost. The venom will linger for hours, a reminder of how close you came to being torn apart.
<br><<AddItemToInventory $serpentpulsesalve>>
<br><<set $health -= 0.15*$basemaxhealth>>
<br><<startStatChanges>>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 1 999 "Demonic Reputation">>
<br><<showStatChanges>>
<br><<link "Retreat, clutching your prize" $passage>><</link>>
<<elseif $pe eq 3>>
You linger in the shadows, studying the serpent's breathing pattern and the subtle pulse of the egg. The creature's chest rises and falls in a rhythm both hypnotic and ancient—each breath carries decades of patience, of maternal devotion older than the oldest mountain.
Something ancient hums here—a rhythm of life and tribulation that vibrates at a frequency the mortal ear cannot perceive, but your cultivation allows you to feel it. It is the song of survival, of sacrifice, of the primal force that drives all creatures to protect their young. You absorb what you can of its qi pattern before leaving, wiser but untouched, understanding the delicate balance between desire and restraint.
<br><<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 0 44 "Insight">>
<br><<gainExp 100 150>>
<br><<showStatChanges>>
<br><<link "Withdraw from the marsh" $passage>><</link>>
<</if>>
<!-- Wounded Cultivator-->
<<elseif $regioneventid eq "reg_8">>
<<if $pe eq 0>>
<<CreateNPC001>>
A wounded cultivator lies slumped against a tree, blood seeping between his fingers as he clutches his side. His breath is shallow, his robes torn, but his eyes flicker open when you approach.
<<set $currentSceneNPC to clone(_npc)>>
<br>[[Go closer->NormalEvents][$pe=1]]
<br><<link "Leave" $passage>><</link>>
<<elseif $pe eq 1>>
You step closer, the smell of iron thick in the air. The cultivator's lips twitch into a faint smile despite his injuries.
<br><span class="male">"C…Cultivator… help me,"</span> he whispers. His voice is hoarse, but there's strength hidden beneath it.
<br><<linkreplace "Treat his wounds" "NormalEvents" >>
You kneel beside him, channeling a thread of spiritual energy into his wounds. The torn flesh knits slowly; his breathing steadies. He groans, body trembling under your touch.
<<set _lewdchance = random(1,100)>>
<<if _lewdchance <= 50>>
<br><span class="male">"You saved me,"</span> he murmurs, eyes closing for a moment in relief. <span class="male">"I won't forget this debt."</span>
<br>[[Continue->NormalEvents][$pe=3]]
<<else>>
<br>His lips curve into a sly grin, even as the pain fades. <span class="male">"Such soft hands… it feels good when you touch me like that."</span> His eyes roam over your figure, shameless even in his weakened state.
The wounded cultivator leans closer, his hand brushing your wrist. <span class="male">"Stay a little longer,"</span> he whispers. <span class="male">"Let me repay your kindness… in another way."</span>
Despite his condition, his intent is clear: his other hand has already slipped lower, fingers grazing the bulge beneath his robes.
<br>[[Scold him->NormalEvents][$pe=3]]
<br><<if $corruption gte 0>>[[Accept his offer->NormalEvents][$pe=2]]<</if>>
<</if>>
<</linkreplace>>
<<elseif $pe eq 2>>
You wrap your hand around his cock, surprised at the heat of him despite his injuries. Thick and heavy, it twitches against your palm as though his lust is stronger than his pain.
<br>The cultivator exhales sharply, his back hitting the rough bark of the tree. <span class="male">"Nnh-your hands… softer than silk,"</span> he groans, his voice trembling between exhaustion and desire. His hips roll weakly, urging you to stroke him harder.
<br>You start slow, dragging your palm along his shaft, feeling every vein pulse beneath your fingers. His cock grows harder with each stroke, precum beading at the tip and smearing slick trails across your knuckles. His hand shoots out, gripping your thigh as if to anchor himself in the haze of pleasure.
<br><span class="male">"Faster,"</span> he begs, panting. <span class="male">"Make me forget the pain…"</span>
<br>You tighten your grip, sliding your hand up and down, wrist twisting just enough to make him buck against you. His cock jerks in your fist, leaking more with each motion, the smell of arousal thick in the cool forest air. His groans rise in pitch, echoing faintly through the trees.
<br><img src="images/Sex/handjob2.webp" class="nsfw-glow">
<br><span class="male">"Spirits… you're draining me more than any battle,"</span> he mutters, his head rolling back. He tries to keep his composure, but each ragged gasp betrays his growing desperation.
<br>You milk him faster, your strokes firm and unrelenting until his whole body trembles. His cock pulses violently in your hand, and with a guttural moan he finally spills, hot streams of cum painting across his torn robes and dripping down his abdomen.
<br>He slumps back, sweat-damp hair clinging to his forehead. His chest rises and falls as he catches his breath, but even spent, a crooked grin spreads across his lips.
<br><span class="male">"You… hah… you've healed me and left me undone in another way. I won't forget the feel of those hands… ever."</span>
<br><<set $currentSceneNPC.hadSex to 1>>
<br><<startStatChanges>>
<br><<gainStat "corruption" "corruption" 2 2 100 "Corruption">>
<br><<gainStat "sexFame" "sexFame" 3 6 999 "Sex Fame">>
<br><<showStatChanges>>
<br><<link "Continue" "NormalEvents">><<set $pe to 3>><</link>>
<<elseif $pe eq 3>>
<<set _npc to $currentSceneNPC>>
The cultivator wipes his mouth, steadying himself. His gaze lingers on you.
<br>He bows his head slightly. <span class="male">"You have my thanks. If fate allows, we will meet again."</span>
<br><<link "Remember him" $passage>> <<AddNPCWithFamily _npc>> <</link>>
<br><<link "Forget him" $passage>><</link>>
<</if>>
<!-- Drunk Wanderer Event -->
<<elseif $regioneventid eq "reg_9">>
<<if $pe eq 0>>
A red-faced mortal stumbles down the road, clutching a cracked jug of wine. His steps sway dangerously, and when he notices you, his lips split into a lopsided grin.
<br><span class="male">"Ahh… a beauty on the road! Come, come-drink with me, share my warmth!"</span> His words slur, and his free hand already reaches out toward you.
<<if $EventAction eq null>>
<br><<link "Indulge him and drink" "NormalEvents">><<set $EventAction to "drink">><</link>>
<br><<link "Ignore him and walk past" "NormalEvents">><<set $EventAction to "ignore">><</link>>
<br><<link "Mock him in front of others" "NormalEvents">><<set $EventAction to "mock">><</link>>
<br><<link "Push him away harshly" "NormalEvents">><<set $EventAction to "push">><</link>>
<br><<if $corruption gte 5>><<link "Let him touch you" "NormalEvents">><<set $pe to 1>><<set $EventAction to "touch">><</link>><</if>>
<<elseif $EventAction eq "drink">>
You accept the jug. The wine is cheap and burns your throat, but the man laughs loudly, slapping his knee.
<br><span class="male">"Hah! You're better company than those village nags. Cultivator or not, you've got spirit!"</span>
<br>He soon stumbles off, humming a broken tune.
<br><<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<<elseif $EventAction eq "ignore">>
You step past without a word. He curses weakly behind you, but he's too drunk to follow.
<br><<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<<elseif $EventAction eq "mock">>
You smirk and say loudly, <span class="player">"Careful, old man, before you drown yourself in piss instead of wine."</span>
<br><<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<br>Nearby mortals laugh cruelly. The wanderer's face reddens with shame.
<<elseif $EventAction eq "push">>
He staggers closer, but you shove him hard. He falls on his ass in the dirt, clutching his wine like it's his child.
<br><span class="male">"Ungrateful witch!"</span> he slurs, spitting on the ground.
<br><<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<</if>>
<<elseif $pe eq 1>>
You don't stop him when his hand grazes your waist. The drunkard chuckles, pressing closer, his breath hot with wine.
<br><span class="male">"Such soft skin… hah, a goddess come down to walk with mortals. Let me… taste you."</span>
<br>You allow his rough, wine-stained hands to paw at your body. His palm cups your breast clumsily through your robes, squeezing as if you were nothing more than a tavern wench.
<br><img src="images/Sex/titgrab.webp" class="nsfw-glow">
<br><span class="male">"Heh… so soft… even immortals feel like women in the end…"</span> he mutters, grinding against you.
<br>His cock is already hard under his filthy trousers, straining against the fabric.
<br>Your hand slides down, tugging at his filthy trousers. His cock springs free, thick and already slick at the tip.
<br>The drunk groans in disbelief, <span class="male">"Ahh… gods above… a fairy touching my cock…"</span> His voice trembles between awe and filth.
<br>You stroke him firmly, your fingers curling around his shaft. His hips jerk helplessly, chasing your hand with drunken desperation.
<br><span class="male">"Faster… don't stop… ahh, fuck-"</span>
<br><img src="images/Sex/handjob1.webp" class="nsfw-glow">
<br>He moans like an animal, seed spilling messily across his own chest and belly. He sags against you, panting and laughing at once.
<br><span class="male">"Hah… hah… blessed by heaven itself…"</span>
<br><<startStatChanges>>
<br><<gainStat "sexFame" "sexFame" 1 3 999 "Sex Fame">>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 3 999 "Demonic Reputation">>
<br><<gainStat "corruption" "corruption" 1 3 100 "Corruption">>
<br><<showStatChanges>>
<br><<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<</if>>
<!-- Peasant Wedding -->
<<elseif $regioneventid eq "reg_10">>
<<if $pe eq 0>>
Lanterns swing gently from wooden poles, their glow casting warm light over a village square. The silk they're made from shimmers with a faint, enchanted luminescence—someone spent coin for quality.
Laughter and music fill the night: a peasant wedding feast in full swing. Musicians strum traditional instruments with practiced fingers, and the melody carries the warmth of a thousand such celebrations. Red banners ripple in the evening wind, embroidered with symbols of prosperity and union, fluttering like the wings of phoenix birds in miniature. Mortals cheer with joy around simple wooden tables laden with roasted meats, steamed vegetables, and ceramic vessels of rice wine.
The aroma of incense mingles with food—sandalwood and jasmine, a touch of luxury that speaks of careful preparation. Even peasants know how to honor an occasion.
Several eyes turn toward you as you approach. The cut of your robes speaks of cultivation rank; the faint aura of Qi around you hums like a tuning fork striking a note mortals feel in their bones. A cultivator is no common guest here. Whispers ripple through the crowd—not fearful, but reverent, tinged with hope that perhaps the heavens themselves have blessed this union.
<br><<link "Approach the feast" "NormalEvents">><<set $pe to 1>><</link>>
<br><<link "Leave" $passage>><</link>>
<<elseif $pe eq 1>>
A long wooden table is crowded with steaming dishes and rice wine, their scents mingling in the warm night air. The villagers bow deeply, making space for you with movements so synchronized they seem almost choreographed. An elder steps forward, his face weathered by decades of tending fields under sun and moon. His eyes, however, are sharp and aware—he understands the weight of a cultivator's presence.
An elder bows low, his movement reverent yet practiced.
<br><span class="male">"Honored Immortal, your presence blesses this humble union. The bride and groom are blessed beyond measure to have caught the attention of one who walks the higher paths. Please, grace us with your presence at our feast. We have prepared what our humble means allow."</span>
His voice carries the accent of the provincial towns, but his sincerity is unmistakable. Around him, the crowd watches with bated breath—will you honor them or scorn them?
<br><<link "Join them politely" "NormalEvents">><<set $pe to 3>><</link>>
<br><<link "Decline with cold pride" $passage>><</link>>
<br><<link "Cause trouble" "NormalEvents">><<set $pe to 2>><</link>>
<<elseif $pe eq 2>>
You sneer at their meager offerings, letting your gaze sweep across the tables with deliberate disdain. Your aura flares—just slightly, enough to make the mortal Qi in the air recoil like a frightened animal.
<span class="player">"This wine is weak swill. These dishes are fit only for pigs, not for one who has tasted the essence of celestial fruits and cultivated spiritual wine. Your efforts are... quaint. Pathetic, even."</span>
The crowd trembles; some glare with suppressed anger, but none dare speak. One young man's fists clench, but his elder restrains him with a single look. Children cry softly as the elder bows repeatedly, begging you not to ruin the day—as if your presence, uninvited, already hasn't cast a shadow across their joy.
Your words sink into their hearts like stones into still water. They will remember this night, and they will remember your cruelty.
<br><<startStatChanges>>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 3 999 "Demonic Reputation">>
<br><<showStatChanges>>
<br><<link "Continue with your journey" $passage>><</link>>
<<elseif $pe eq 3>>
You settle among them with deliberate grace. The mortals pour rice wine into your cup with shaking hands—some from reverence, some from fear—watching your every movement as if you might suddenly transform into something otherworldly. Which, of course, you are.
Children sneak glances at you from behind their parents' robes, as if staring too long might blind them or draw divine lightning down upon their heads. One brave little girl, no more than five years old, reaches out to touch the hem of your sleeve before her mother yanks her back with an apologetic bow.
The feast drags into the night, laughter mixing with the crackle of torches, but it's a laughter tinged with nervousness. Your presence has transformed the celebration into something else—not quite fear, not quite reverence, but something in between. The wine tastes sweeter on their lips knowing a cultivator shares their table.
<<set _nsfwchance = random(1,100)>>
<br><<linkreplace "Offer a gift to the couple" "NormalEvents">>
<br><<startStatChanges>>
<br><<gainStat "PCrighteousreputation" "PCrighteousreputation" 1 3 999 "Righteous Reputation">>
<br><<showStatChanges>>
You produce a small pouch of spirit stones from your storage ring—nothing extravagant by cultivator standards, but worth more than this village earns in a year. The crowd gasps as if you've just revealed a cache of celestial jade.
<br><span class="player"> "Blessings upon your union. May your bloodline carry fortune for ten generations. May your descendants walk higher paths than you have walked."</span> Your voice carries the weight of genuine benediction, and for a moment, your aura flares bright enough to cast shadows dancing across the feast.
The elder kneels, tears streaming down his weathered face. Your magnanimity will be remembered—songs may even be sung about this night in the village square for years to come.
<</linkreplace>>
<br><<linkreplace "Stay silent, enjoy food" "NormalEvents">>
The wedding fades behind you as you step back onto the road. Mortals return to their joy, unaware—or willfully blind—to what transpired beneath the moonlight. Your presence becomes a memory, a story they'll tell with wonder and uncertainty about whether it truly happened or if it was a collective dream sent by benevolent spirits.
<br><<link "Continue with your journey" $passage>><</link>>
<</linkreplace>>
<<if _nsfwchance <= 40>>
<br><<link "Later in the night…" "NormalEvents">><<set $pe to 4>><</link>>
<</if>>
<<elseif $pe eq 4>>
<<set _brideorgroom = random(1,2)>>
<<if _brideorgroom == 1>>
<!-- Bride variant -->
The young bride, cheeks flushed from too much wine, grasps your sleeve.
<br>Her wedding veil hangs loose, eyes glazed but yearning.
<br><span class="female">"Immortal… before I give myself to a mortal man, grant me a blessing. Let me taste divinity, if only once…"</span>
<br><<link "Indulge her" "NormalEvents">><<set $pe to 5>><</link>>
<br>[[Gently refuse->$passage]]
<<else>>
The groom, staggering and drunk, collapses to his knees before you.
<br>His eyes are wild with awe and wine.
<br><span class="male">"Great one…! Share your power with me tonight-let me *truly* honor this marriage bed." </span>
<br><<link "Indulge him" "NormalEvents">><<set $pe to 6>><</link>>
<br>[[Shove him aside->$passage]]
<</if>>
<<elseif $pe eq 5>>
With a swift movement, you push her gently onto the soft grass behind the feast hall. Lantern light flickers across her face, wide eyes, lips parted, breath hitching.
<br><span class="player">"On your knees,"</span> you order, your hand gripping her hair lightly, tilting her head toward your waiting fingers.
<br>She obeys immediately, hands clutching your thighs, eyes locked on yours as you slowly slide a finger into her wet cunt, teasing her. She gasps, shivering as your finger probes deeper.
<br><span class="player">"Gods… you're so tight… my little mortal slut,"</span> you murmur, circling her clit with your thumb, watching her moan.
<br>Her hands slide over your robes, tugging at them, desperate to feel your skin. You press your palm against her mouth, smirking.
<br><span class="player">"No touching yet… you'll learn to obey,"</span> you whisper, thrusting two fingers inside her cunt. She moans loudly, hips jerking toward you.
<br><<linkreplace "Continue">>
<br><img src="images/Sex/lesbian.webp" class="nsfw-glow">
<br><span class="female">"Yes… yes, Mistress… please…",</span> she gasps, voice trembling. You push her onto her back, straddling her, grinding your cunt against hers. She bites her lip, whimpering as your wet pussy presses into hers.
<br>You lean down, gripping her chin, forcing her eyes to meet yours.
<br><span class="player">"You're mine tonight," </span> you growl, slipping a finger into her mouth while thrusting against her with your pussy. She sucks greedily, trying to taste the nectar of your arousal.
<br>Her hands roam over your hips and breasts, tugging, kneading, desperate for more. You push her wrists above her head, smirking at her helplessness.
<br><span class="player">"Beg me to fuck you with my fingers… beg for it, slut,"</span> you demand. She gasps, trembling,
<br><span class="female">"Please… fuck me… make me cum, Mistress…"</span>
<br>You plunge your fingers into her cunt, curling them expertly, watching her shudder, hips bucking. Her juices mix with yours, slick and dripping, painting the grass beneath you.
<br><span class="player">"Cum for me, little mortal… cum all over my fingers,"</span> you command. Her back arches, scream muffled against your hand, body trembling as she spills her first orgasm.
<br>Not done yet, you grind your wet pussy against hers again, pressing her face into your chest, forcing her to taste your arousal. She moans around your nipple, writhing under your control.
<br><<startStatChanges>>
<br><<gainStat "sexFame" "sexFame" 1 5 999 "Sex Fame">>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 4 999 "Demonic Reputation">>
<br><<gainStat "corruption" "corruption" 1 3 100 "Corruption">>
<br><<showStatChanges>>
<br><<link "Continue with your journey!" $passage>><</link>>
<</linkreplace>>
<<elseif $pe eq 6>>
The groom's eyes blaze with drunken lust as he shoves you against the side of the tavern wall. His hands grip your shoulders, forcing you to look at him.
<br><span class="male">"I'm going to taste you… you're mine tonight, immortal,"</span> he growls, fingers digging into your arms.
<br>You try to pull away, but he shoves your robes open, exposing your soft, pale skin. His cock throbs visibly through his trousers, slick with arousal.
<br><span class="male">"Beg me… beg me to fuck your cunt,"</span> he snarls, shoving you down onto your knees.
<br><img src="images/Sex/sideBlowjob.webp" class="nsfw-glow">
<br>Your breath catches, cheeks flushing, and your fingers clutch at his belt. His hands shove your head down toward his cock. You swallow around it, trembling as his length presses against your lips, hot and heavy.
<br><span class="male">"Lick it, whore… show me you're worthy,"</span> he growls.
<br>You obey, lips sliding down his cock as he groans, gripping your hair roughly. The taste of sweat and wine mixes with his pre-cum, slicking your lips and dripping onto your tongue. Every suck, every lick draws a sharp, guttural groan from him, and he thrusts into your mouth, forcing you deeper.
<br><<linkreplace "Continue">>
<br><span class="male">"Goddamn… your little cunt is going to taste every drop of my cum,"</span> he snarls, jerking his cock violently in your throat. You gag, choke, and moan around him, the sound lost under his heavy breathing.
<br><img src="images/Sex/pb.webp" class="nsfw-glow">
<br>He shoves you onto the floor, straddling your chest roughly. His cock presses against your pussy, wet and needy. He thrusts hard, groaning as your cunt spreads around him, the tight warmth gripping him.
<br><span class="male">"So fucking tight… you like being my little slut, don't you?"</span> he pants.
<br>You whimper, nodding submissively, hands clutching at his arms as he slams into you over and over. His hips smash against yours, cock plunging deep, messy with your slick. You moan and whine, cunt dripping, body trembling under his violent thrusts.
<br><span class="male">"Fuck… cum for me, cunt… I'll fill you with my sperm,"</span> he growls, grabbing your hair and forcing your head back as he shoves his cock in deeper. His hands roam over your body, pinching your nipples, squeezing your ass, leaving bruises as he fucks you ruthlessly.
<br>Your body shakes, pussy clenching around him, and you cry out as your orgasm hits, slick spilling down your thighs. He doesn't let up, fucking you through your climax, shoving his cum deep into your cunt until you're nothing but a messy, trembling heap under him.
<br>Finally spent, he collapses atop you, breathing heavily, sweat mixing with your own. Your hair is mussed, robes torn, cunt soaked with his cum.
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "random groom">>
<br><span class="red">You lost your virginity to $virginityLost!</span>
<<set $humanSexCount += 1>>
<</if>>
<br><<startStatChanges>>
<br><<gainStat "sexFame" "sexFame" 1 5 999 "Sex Fame">>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 4 999 "Demonic Reputation">>
<br><<gainStat "corruption" "corruption" 1 3 100 "Corruption">>
<br><<showStatChanges>>
<br><<link "Continue with your journey!" $passage>><</link>>
<</linkreplace>>
<</if>>
<!-- ════════════════════════════════════════════════════
Wandering Merchant Troupe · reg_13
════════════════════════════════════════════════════ -->
<<elseif $regioneventid eq "reg_13">>
<<MerchantTroupeWidget>>
<</if>>
<<if $randomeventid eq 14>>
EMPTY THO
<</if>>/* ─────────────────────────────────────────────
SECT_1 — Senior disciple blocking your path
───────────────────────────────────────────── */
<<if $regioneventid is "sect_1">>
<<set _disciple to {name: "Senior Brother Fang Lie", rank: "Inner Disciple"}>>
<p>He looks you over slowly — not with hostility, but with the quiet confidence of someone who has never had to hurry. His sect robes are immaculate. The embroidered crest on his chest marks him two full ranks above you.</p>
<p>"You've been wandering the outer paths alone," he says. It isn't a question. "A woman of your… cultivation travelling unescorted." A pause. "Interesting."</p>
<<if $CurrentPcSectRank is "Initiate" or $CurrentPcSectRank is "Disciple">>
<p>His tone is cordial, but the hierarchy between you is impossible to ignore. An Initiate challenging a senior directly would be noted — and remembered.</p>
<<elseif $CurrentPcSectRank is "Inner Disciple">>
<p>You are his equal in rank. That makes this conversation different. He knows it too.</p>
<<elseif $CurrentPcSectRank is "Core Disciple" or $CurrentPcSectRank is "True Disciple" or $CurrentPcSectRank is "Elder">>
<p>His posture shifts almost imperceptibly as he registers your rank. Whatever he intended, he is recalculating.</p>
<</if>>
<div id="event-choices">
<<link "Stand your ground — meet his gaze without flinching">>
<<set $PCrighteousreputation += 2>>
<<replace "#event-choices">>
<p>You hold his stare. A long moment passes. Something flickers at the corner of his mouth — not mockery, but recognition. He uncrosses his arms.</p>
<p>"Good." He steps aside and gestures along the path. "Disciples who flinch don't last in the outer territories." He falls into step beside you, uninvited. "I'll walk with you awhile. Consider it… courtesy."</p>
<p>He does not touch you. He does not need to. The weight of his attention is its own kind of pressure.</p>
<<startStatChanges>>
<<gainStat "PCrighteousreputation" "PCrighteousreputation" 2 0 999 "Righteous reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<<link "Lower your eyes — play the obedient junior disciple">>
<<replace "#event-choices">>
<p>You drop your gaze and fold your hands. The performance is perfect.</p>
<p>He steps closer. You can feel him studying you — the curve of your neck, the way your breath has slowed. "Much better," he murmurs. His fingers brush your chin, tilting your face up anyway. "No point in hiding such a pretty thing."</p>
<p>He holds your face there for a breath longer than is appropriate, then releases you and steps back with a satisfied smile.</p>
<p>"You may pass, junior sister. I'll be watching your progress."</p>
<<startStatChanges>>
<<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 0 999 "Demonic Reputation">>
<<loseStat "PCrighteousreputation" "PCrighteousreputation" 1 0 999 "Righteous Reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<<if $corruption gte 30>>
<<link "Press him — suggest he owes you something for blocking your path">>
<<replace "#event-choices">>
<p>You smile and let the silence stretch. "You stopped me, Senior Brother. That cost me time." You tilt your head. "I wonder what you intend to do about that."</p>
<p>The surprise on his face is brief. Then — satisfyingly — it melts into something warmer. He steps in close, voice dropping low.</p>
<p>"Bold little thing." His hand finds your waist, testing. When you don't pull away, he pulls you closer. "I can think of a few ways to make it up to you."</p>
<p>What follows is not gentle. But you asked for that.</p>
<<startStatChanges>>
<<gainStat "corruption" "corruption" 2 0 100 "Corruption">>
<<gainStat "PCdemonicreputation" "PCdemonicreputation" 3 0 999 "Demonic Reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<</if>>
<<link "Challenge him to a sparring match — let cultivation speak">>
<<replace "#event-choices">>
<p>"If you want to assess me," you say evenly, "spar with me."</p>
<p>His eyebrows rise. Then he laughs — a real one. He rolls his shoulder and shifts into a stance.</p>
<p>"Now that is the right answer."</p>
<p>The match is brief and instructive. He is better than you expected, but you hold your own. When it ends, he clasps his hands and gives a small, genuine bow.</p>
<p>"You'll go far, junior sister." He sounds like he means it.</p>
<<startStatChanges>>
<<gainStat "PCrighteousreputation" "PCrighteousreputation" 3 0 999 "Righteous reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
</div>
/* ─────────────────────────────────────────────
SECT_2 — Rogue cultivator wanting blood
───────────────────────────────────────────── */
<<elseif $regioneventid is "sect_2">>
<<set _rogue to {name: "Hollow Fang cultivator"}>>
<p>He emerges fully now — ragged robes, qi scarred and jagged from years outside any sect structure. His eyes are hungry. Not for your cultivation resources. For the kill itself.</p>
<p>"I've cut down three sect dogs this season," he says conversationally, drawing a thin blade. "You'll make four. I collect the cores." He smiles. "The women I collect differently."</p>
<div id="event-choices">
<<link "Draw your weapon — end this quickly">>
<<replace "#event-choices">>
<p>You don't answer. You move.</p>
<p>He's fast — rogue cultivators always are, they have nothing to lose. But his qi is fractured and undisciplined. You find the gap in his form and press it.</p>
<p>When it's over, he's on his knees in the dirt, blade gone, breathing hard. You hold the point of your weapon to his throat.</p>
<p>"Four," he manages.</p>
<p>"Try five." You step back and let him run. He takes it.</p>
<<startStatChanges>>
<<gainStat "PCrighteousreputation" "PCrighteousreputation" 2 0 999 "Righteous reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<<link "Negotiate — offer him sect resources in exchange for leaving">>
<<replace "#event-choices">>
<p>"You want resources," you say. "Cores, spirit stones. Not a fight."</p>
<p>He tilts his head. Suspicious, but listening.</p>
<p>You keep your hands visible and your voice even as you name a price. It costs you some of what you've gathered today, but he sheathes the blade and spits to the side.</p>
<p>"Smart girl." He pockets the stones and fades back into the tree line.</p>
<<startStatChanges>>
<<gainStat "PCdemonicreputation" "PCdemonicreputation" 2 0 999 "Demonic Reputation">>
<<loseStat "PCrighteousreputation" "PCrighteousreputation" 1 0 999 "Righteous Reputation">>
<<showStatChanges>>
<p>You lose some spirit stones.</p>
<<set $spirit_stones -= 5>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<<if $corruption gte 40>>
<<link "Let him approach — turn this on its head">>
<<replace "#event-choices">>
<p>You sheathe your weapon.</p>
<p>He blinks. Stops. The hunger in his eyes shifts shape as you step toward him instead.</p>
<p>"You said women differently," you say. "Show me what you meant."</p>
<p>Whatever he intended to take by force, he suddenly finds offered freely — and that breaks him more completely than any blade would have. He is rougher than a sect cultivator, and you allow it, and somewhere in the middle of it his hands stop shaking and he forgets entirely that he wanted to kill you.</p>
<p>Afterward, he sits in the dirt and stares at you with something like awe.</p>
<p>"What sect are you?" he asks.</p>
<p>You don't answer. You straighten your robes and walk past him.</p>
<<startStatChanges>>
<<gainStat "corruption" "corruption" 3 0 120 "Corruption">>
<<gainStat "PCdemonicreputation" "PCdemonicreputation" 4 0 999 "Demonic Reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<</if>>
<<link "Use your sect rank — warn him of the consequences">>
<<replace "#event-choices">>
<p>You name your sect clearly and let the weight of it land. A <<print $CurrentPcSectRank>> of the sect does not disappear quietly. The investigation would follow.</p>
<p>He weighs it. You can see him doing it — calculating how much trouble a body brings. His jaw tightens.</p>
<p>"Next time," he says, and vanishes into the undergrowth.</p>
<<startStatChanges>>
<<gainStat "PCrighteousreputation" "PCrighteousreputation" 1 0 999 "Righteous reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
</div>
/* ─────────────────────────────────────────────
SECT_3 — Sect members plotting betrayal
───────────────────────────────────────────── */
<<elseif $regioneventid is "sect_3">>
<p>You go still. Through the brush, you make out three disciples — outer robes, familiar crests. Their voices are low but your cultivation is sharper than they expect.</p>
<p>Names. A meeting point. A price. Someone from an enemy sect is paying for information about the inner sanctum's patrol schedule — and at least one of these three has already agreed to sell it.</p>
<p>They haven't noticed you yet.</p>
<div id="event-choices">
<<link "Confront them directly">>
<<replace "#event-choices">>
<p>You step out of the undergrowth.</p>
<p>The three of them spin. One reaches for a weapon. You let your qi flare once — just enough — and the arm freezes.</p>
<p>"<<print $CurrentPcSectRank>>," you say. "Whatever you've agreed to, unmake it. Now. And then you'll come with me to the Elder Hall."</p>
<p>Two of them fold immediately. The third runs. You let him. He'll be found.</p>
<<startStatChanges>>
<<gainStat "PCrighteousreputation" "PCrighteousreputation" 5 0 999 "Righteous reputation">>
<<loseStat "PCdemonicreputation" "PCdemonicreputation" 2 0 999 "Demonic Reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<<link "Withdraw silently — report it to your sect leadership">>
<<set $PCrighteousreputation += 3>>
<<replace "#event-choices">>
<p>You pull back without a sound. Better to let them finish the conversation — you want names, a timeline, specifics. You commit every word to memory.</p>
<p>By nightfall you've delivered a full account to a sect elder. The disciples are detained before dawn.</p>
<p>The elder looks at you with quiet approval. "Good judgment, <<print $CurrentPcSectRank>>."</p>
<<startStatChanges>>
<<gainStat "PCrighteousreputation" "PCrighteousreputation" 3 0 999 "Righteous reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<<if $PCdemonicreputation gte 20>>
<<link "Approach them — offer to cut yourself in">>
<<replace "#event-choices">>
<p>You step into their circle before they can scatter, hands loose, expression easy.</p>
<p>"Whatever they're paying," you say, "I can open doors you can't."</p>
<p>Silence. One of them starts to protest. Another grabs his arm.</p>
<p>"She's a <<print $CurrentPcSectRank>>," he mutters. "Think about what access she has."</p>
<p>The negotiation is quick and cold. You walk away with a share of the payment and a future contact outside the sect — and three traitors who are now, technically, loyal to you.</p>
<<startStatChanges>>
<<gainStat "corruption" "corruption" 2 0 100 "Corruption">>
<<gainStat "PCdemonicreputation" "PCdemonicreputation" 5 0 999 "Demonic Reputation">>
<<loseStat "PCrighteousreputation" "PCrighteousreputation" 3 0 999 "Righteous Reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<</if>>
<<if $corruption gte 35>>
<<link "Use what you've heard as leverage — blackmail them privately">>
<<replace "#event-choices">>
<p>You wait until the three of them separate. Then you find the one who looked most frightened — the follower, not the ringleader — and you step onto his path.</p>
<p>He pales when he realises you were there. Were listening. Have been, for a while.</p>
<p>You don't raise your voice. You don't have to. You name your terms quietly: silence, in exchange for services rendered — and rendered well.</p>
<p>He agrees. He has no choice and he knows it. The fear in his face shifts into something else as you make the nature of the arrangement clear. Not entirely unwilling. Just cornered.</p>
<<startStatChanges>>
<<gainStat "corruption" "corruption" 2 0 100 "Corruption">>
<<gainStat "PCdemonicreputation" "PCdemonicreputation" 4 0 999 "Demonic Reputation">>
<<showStatChanges>>
<p>[[Continue your patrol|Map|Region1]]</p>
<</replace>>
<</link>>
<br>
<</if>>
</div>
<</if>><<widget "RichQiPlace_Region1">>
<b>You've stumbled upon a place brimming with rich spiritual energy! The air is thick with qi.</b>
The density of spiritual energy here is extraordinary — a place perfect for cultivation.
Do you want to cultivate?
<<link "Yes" "QiCultivation_Region1">><</link>>
<</widget>>
<<widget "RareHerbs_Region1">>
<b>While traveling, you stumble upon a patch of rare herbs growing beside the path. Their scent is rich, almost intoxicating.</b>
Their subtle fragrance suggests strong medicinal properties.
Do you want to gather them?
<<link "Yes" "RareHerbs_Region1">><</link>>
<</widget>>
<<widget "HerbFinder">>
<<for _i to 0; _i lt $playeriteminventory.length; _i++>>
<
<</for>>
<</widget>><<widget "RegionEvents">>
<<if not $regionEvent.active>>
<!-- safety: nothing to show -->
<<else>>
<<set _id = $regionEvent.id>>
<<if $regionEvent.active and $playerX is $regionEvent.x and $playerY is $regionEvent.y>>
<<if _id is "reg_1">>
<<set $regioneventid to "reg_1">>
<p>The grove is hushed, save for the sigh of bamboo swaying like an endless sea. Yet beneath the rustle, whispers slither - too deliberate to be mere wind.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_2">>
<<set $regioneventid to "reg_2">>
<p>A lotus blooms in the middle of a bloodied pond. Its petals shimmer like fresh wounds.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_3">>
<<set $regioneventid to "reg_3">>
<p>You find a cracked jug half-buried in earth. A heavenly fragrance leaks from within.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_4">>
<<set $regioneventid to "reg_4">>
<p>A monstrous humanoid pig blocks your path, tusks gleaming.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_5">>
<<set $regioneventid to "reg_5">>
<p>A fox-woman dances in the mist, her many tails swaying hypnotically.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_6">>
<<set $regioneventid to "reg_6">>
<p>A broken bell tower groans in the wind, its echo haunting the land.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_7">>
<<set $regioneventid to "reg_7">>
<p>A massive serpent coils around a glowing egg, watching you carefully.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_8">>
<<set $regioneventid to "reg_8">>
<p>A wounded cultivator leans against a tree, barely breathing.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_9">>
<<set $regioneventid to "reg_9">>
<p>A drunk wanderer staggers toward you, grinning foolishly.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_10">>
<<set $regioneventid to "reg_10">>
<p>A lively mortal wedding fills the area with laughter and lantern light.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
<<elseif _id is "reg_11">>
<<set $regioneventid to "reg_11">>
<p>You discover glowing herbs rich with concentrated qi.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "RareHerbs_Region1">>
<</link>>
<<elseif _id is "reg_12">>
<<set $regioneventid to "reg_12">>
<p>A peaceful clearing filled with dense qi invites meditation.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "QiCultivation_Region1">>
<</link>>
<<elseif _id is "reg_13">>
<<set $regioneventid to "reg_13">>
<p>A merchant caravan has set camp, filled with exotic goods.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalEvents">>
<</link>>
/* === SECT EVENTS === */
<<elseif _id is "sect_1">>
<<set $regioneventid to "sect_1">>
<p>A senior disciple from your sect blocks your path, arms folded. His gaze is sharp, evaluating.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalSectEvents">>
<</link>>
<<elseif _id is "sect_2">>
<<set $regioneventid to "sect_2">>
<p>A rogue cultivator steps from the shadows. "A sect dog… perfect prey."</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalSectEvents">>
<</link>>
<<elseif _id is "sect_3">>
<<set $regioneventid to "sect_3">>
<p>You overhear whispers — sect members plotting betrayal.</p>
<<link "Approach">>
<<set $regionEvent.active = false>>
<<goto "NormalSectEvents">>
<</link>>
<<else>>
<p>Something feels wrong… (invalid event)</p>
<<set $regionEvent.active = false>>
<</if>>
<</if>>
<</if>>
<</widget>><<if $pe eq 0>>
<<ArrogantYoungMaster>>
As you step closer to the disturbance, the young master stops mid-insult. He leaves the trembling server and turns his full, predatory attention toward you.
Up close, he is a youth no older than twenty, hair pinned with golden clasps, his silk robes shimmering with a faint spiritual glow that marks him as a pampered disciple. He scans you from head to toe, a sharp smirk spreading across his face.
<span class="male">“So,”</span> he says, voice dripping with unearned superiority. <span class="male">“A wandering insect thinks she can intervene? This tavern is full of rats, but you... you have a certain flavor.”</span>
He steps into your personal space, his entourage fanning out behind him with smug, expectant grins.
<span class="male">“Crawl to me on all fours, and I may forgive you for breathing my air.”</span>
The tavern goes deathly silent. He leans in closer, his eyes dark. <span class="male">“Or don’t. I’ll enjoy breaking your legs and watching you squirm in the dirt anyway.”</span>
<hr>
<div id="choice">\
<<link "Obey him. Crawl.">><<set $backgroundClass to "tavern">>
<<replace "#choice">>
The words hang in the air like poison.
<span class="male">“Crawl to me on all fours.”</span>
Laughter bubbles from his entourage, cruel and excited. The tavern watches in uncomfortable silence — but no one stops you as you slowly, deliberately, drop to your knees.
<<set _random0 = random(0,2)>>
You place your palms to the dusty wooden floor and begin to crawl toward him.
<<if _random0 eq 0>>
<img src="images/Sex/crawl.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/crawl1.webp" class="nsfw-glow"><<elseif _random0 eq 2>>
<img src="images/Sex/crawl3.webp" class="nsfw-glow"><</if>>
<span class="male">“Good,”</span>he purrs, voice silk-wrapped steel. <span class="male">“See? Even lowly insects can learn obedience.”</span>
When you reach him, he lifts one foot and presses the sole of his ornate boot against your shoulder — not hard enough to hurt, but enough to assert dominance.
<span class="male">“Now beg me to let you serve me in private.”</span>
<<linkappend "You’re taken to a private backroom. The guards remain outside.">>
<<set $backgroundClass to "tavernRoom">>
Inside, the arrogant young master watches you with idle amusement as he reclines on a padded seat. He undoes the sash of his inner robe, letting it slide open just enough to reveal his bare chest… and the growing bulge beneath silk pants.
<span class="male">“Strip, then crawl here and use your mouth. You’ll start there, and if I’m pleased, I’ll use the rest of you.”</span>
On your knees before him, you free his cock — thick, flushed, already hard with anticipation. He’s arrogant about it too, holding your chin and tapping the tip against your lips before letting you take him into your mouth.
<span class="male">“Not bad… for a nobody.”</span>
<div style="position: relative; width: 70%; height: auto;">
<<BackgroundHandler>>
<img src="images/Sex/sideBlowjob.webp" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
He moans as you work your lips along his shaft, guiding your rhythm with one hand tangled in your hair. The position is degrading, and that’s exactly how he wants it.
After he’s had enough, he pulls back and stands.
<<Penetration_roll>>
<<if _penetration eq "vaginal">>
<<set _position to ["doggy","cowgirl"].random()>>
<<if _position eq "doggy">>
<<AymTavernImg>>
<<if $virginity eq 1>><<set $virginity = 0>><<set $virginityLost = _npc.fullname>><<set $humanSexCount += 1>>
<span class="red">You lost your virginity to _npc.fullname!</span>
<</if>>
<span class="male">“Turn around. On all fours — like the dog you are.”</span>
You obey, pressing your chest to the cushions as he mounts you from behind.
<<set_aym_doggy_desc>>
_random_desc_1
<<set_aym_doggy_talk>>
<span class="male">"_random_talk_1"</span>
_random_desc_2
<span class="male">"_random_talk_2"</span>
_random_desc_3
<span class="male">"_random_talk_3"</span>
<<linkappend "It wasnt really long before you heard a grunts of incoming orgasm from the guy.">>
<<AymFinisher>>
<span class="male"> "_finisher_talk_1" </span>
_finisher_desc_1
<<link "Gather your things and leave in shame" $passage>><<set $sexFame += random(4,7)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><</link>>
<</linkappend>>
\
<<elseif _position eq "cowgirl">>
<<AymTavernImg>>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = _npc.fullname>><<set $humanSexCount += 1>>
<span class="red">You lost your virginity to _npc.fullname!</span>
<</if>>
<<set_aym_cowgirl_desc>>
_random_desc_1
<<set_aym_cowgirl_talk>>
<span class="male">"_random_talk_1"</span>
_random_desc_2
<span class="male">"_random_talk_2"</span>
_random_desc_3
<span class="male">"_random_talk_3"</span>
<<linkappend "It wasn't really long before you heard a grunts of incoming orgasm from the guy.">>
<<AymFinisher>>
\
<span class="male"> "_finisher_talk_1" </span>
_finisher_desc_1
\
<<link "Gather your things and leave in shame" $passage>><<set $sexFame += random(4,7)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><</link>>
<</linkappend>>
<</if>>
\
<<elseif _penetration eq "anal">>
\
<<if $analVirginity eq 1>><<set $humanSexCount += 1>>
<<set $analVirginity = 0>>
<<set $analVirginityLost = _npc.fullname>>
<span class="red">You lost your anal virginity to _npc.fullname!</span>
<</if>>
\
<<AymTavernImg>>
<<set_aym_proneboneANAL_desc>>
_random_desc_1
<<set_aym_proneboneANAL_talk>>
<span class="male">"_random_talk_1"</span>
_random_desc_2
<span class="male">"_random_talk_2"</span>
_random_desc_3
<span class="male">"_random_talk_3"</span>
<<linkappend "It wasnt really long before you heard a grunts of incoming orgasm from the guy.">>
<<AymFinisher>>
<span class="male"> "_finisher_talk_1" </span>
_finisher_desc_1
<<link "Gather your things and leave in shame" $passage>><<set $sexFame += random(4,7)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><</link>>
<</linkappend>>
<</if>>
<</linkappend>>
<</replace>>
<</link>>
<<link "Refuse with pride.">>
<<replace "#choice">>
You cross your arms and stare him down, utterly unmoved.
<span class="player">"I don't bow to worms dressed in silk."</span>
The room goes still.
The young master’s eyes flash with fury. <span class="male">“Break her knees.”</span>
<<if $totalFame gt 500>>
<<set _roll to random(0,100)>>
<<if _roll lt 50>>
<span class="male1">"Wait… that’s $playername $playersurname. The one who crippled a Core disciple with a single palm at the trial grounds.”</span>
_npc.fullname blinks. His hand freezes mid-gesture.
One of the guards leans in and whispers something urgently in his ear.
The young master’s face turns pale. He swallows.
<span class="male">“Tch. This place isn't worth dirtying my hands.”</span>
He spins on his heel, robes whipping the air. <span class="male">“Come, we’re leaving.”</span>
<<else>>
<span class="male1"> “Wait!”</span>One of his guards steps in front of him, looking visibly uneasy. <span class="male1"> “That’s the $playername $playersurname ”</span>The young master freezes. His lips press into a thin line.
Around the room, people are whispering your name. Several onlookers shift in their seats—one even lifts their cup in a silent toast.
<span class="male">“Tch… Don’t think your fame makes you untouchable forever.”</span> But the words are hollow. He turns and storms out, his entourage following, visibly shaken.
<</if>>\
<i>Try to stop him?</i>
<<link "Stop him!" "Arrogant Young Master Tavern">><<set $pe to 10>><</link>>
<<else>>
The room goes quiet. His smirk fades.
<span class="male">"Worm?"</span>His voice rises slightly. <span class="male">“Who the fuck do you think you are?”</span>
You sense it—the shift. There's no recognition in the room. No fear in the guards’ eyes. The patrons look away, uninterested. No one whispers your name.
You’re no one. Not yet.
The room goes quiet. His smirk fades.
<span class="male">"Worm?"</span>His voice rises slightly. <span class="male">“Who the fuck do you think you are?”</span>
You sense it—the shift. There's no recognition in the room. No fear in the guards’ eyes. The patrons look away, uninterested. No one whispers your name.
You’re no one. Not yet.
The young master’s face twists with fury.
<span class="male">“Then I’ll beat the dignity into you. I’ll break your legs and feed your spiritual root to dogs.”</span>
<<BeforeBattle>>
<<link "To battle!" "TavernBattle">><<set $pe to 0>><<set $nextPe to 1>><<set $passage to "TavernBattle">><</link>>
<</if>>
<</replace>>
<</link>>
<<link "Mock him back.">>
<<replace "#choice">>
The arrogant young master’s lip curls in contempt as he stands before you, his hand lazily gesturing to the floor.
<span class="male"> “Crawl to me, and I may spare you from becoming a cripple tonight.”</span>You lean back in your chair, smile slow and mocking.
<span class="player"> “You want me on all fours? Buy me dinner first, young master.”</span>
The moment hangs in the air like drawn steel. A few chuckles ripple through the tavern—but they die quickly. No one shouts your name. No gasps of recognition. You’re just… some nobody with a sharp tongue.
The young master’s smile fades.
<span class="male">“What did you just say?”</span>. His voice trembles—not from fear, but from barely suppressed rage. He turns slowly toward his guards.
<span class="male">Break their jaw. Then break their hands. Let’s see how funny they are with no tongue or fingers.”</span>
His guards start moving—this time with no hesitation.
<<BeforeBattle>>
<<link "To battle!" "TavernBattle">><<set $pe to 0>><<set $nextPe to 1>><<set $passage to "TavernBattle">><</link>>
<</replace>>
<</link>>
<<elseif $pe eq 1>>
<<nobr>>
<br>You catch the next guard’s wrist mid-swing.
<br>CRACK. His bone breaks in your grip. Another guard draws a sword—you flick two fingers, and his blade shatters.
<br>The young master stumbles back, wide-eyed. He stammers.
<br><span class="male">“Y-You dare hit me?! My father is the Sect Lord of—”</span>
<div id="choice">
<br><<link "Slap him across the face">>
<br><<replace "#choice">>
<br>You casually raise your hand—and deliver a thunderous slap.
<br><div style="position: relative; width: 70%; height: auto;"><<BackgroundHandler>><img src="images/Story/bitchslap.webp" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"></div>
<br>A shockwave ripples out. The young master spins mid-air before crashing into the bamboo thicket.
<br><span class="male">"Y-you—!"</span> He spits blood and teeth.
<br>The guards glance at each other—then drop their weapons and flee.
<br><span class="player">“Tell your father: the world doesn't bend for spoiled children.”</span>
<br><<link "Go back" $city>> <<set $PCrighteousreputation += 1>><<set $fame += random(3,6)>> <</link>>
<</replace>>
<</link>>
<br><<link "Step forward and crush his pride">>
<br><<replace "#choice">>
<br>You step closer, gaze like a blade.
<br><span class="player">"Your father's title means nothing here."</span>
<br>Your aura flares—dense, suffocating. He drops to his knees before he even realizes.
<br>He can't meet your eyes.
<br>The remaining guards scatter without a word.
<br>You turn away, leaving them behind like dust in the wind.
<br><<link "Go back" $city>> <<set $PCdemonicreputation += 1>> <<set $fame += random(3,6)>><</link>>
<</replace>>
<</link>>
<br><<link "Let him run—like the coward he is">>
<br><<replace "#choice">>
<br>You say nothing. Just look at him.
<br>The pressure in the air thickens. He trembles, then bolts into the forest, stumbling over his own ego.
<br>The remaining guards scatter like leaves.
<br><<link "Go back" $city>> <<set $fame += random(3,6)>> <</link>>
<</replace>>
<</link>>
</div>
<</nobr>>
<<elseif $pe eq 2>>
The arrogant young master towers above you as you sprawl on the tavern’s wooden floor, breath ragged from the blows his guards landed. The world smells of spilled wine and smoke, and every gaze in the room is fixed on you—waiting, whispering.
<span class="male">“Still defiant?” </span>
His voice drips with mockery. He presses the heel of his embroidered boot harder into your belly.
<span class="male">“Let’s see how long that dignity lasts, insect.”</span>
The pressure is unbearable. Your body spasms, bladder straining. You claw at the floorboards, cheeks flushing with humiliation. A choked sound escapes your throat as your muscles finally betray you.
A dark warmth spreads beneath you, soaking through the silk of your dress. The humiliating hiss of liquid is unmistakable as your thighs grow wet. You’re pissing yourself—helpless, humiliated, right there on the tavern floor.
Laughter ripples through the air. The young master leans closer, his hand sliding up your leg possessively, fingers pressing into your trembling thigh. His smirk is wide, cruel, triumphant.
<img src="images/Sex/piss.webp" style="width: 70%; display: block; margin: 10px auto;">
<span class="male">“There. Look at you now. A proud cultivator… reduced to a piss-soaked dog. Remember this the next time you dare raise your voice to me.”</span>
The puddle spreads, steam rising faintly in the heat of the tavern. Your blue eyes meet his for a fleeting moment—shame burning so hot it almost eclipses your fear. Almost.
<<link "Gather your things and leave in shame" $city>><<set $sexFame += random(2,5)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><<set $combatFame -= 1>><<set $fame -= 2>><</link>>
<</if>><<set _npc to $currentEncounterNPC>>
<<if _npc is undefined>>
<p>Encounter data is missing.</p>
<<if $encounterOriginPassage>>
<<link "Back" $encounterOriginPassage>><</link>>
<</if>>
<<else>>
<<set _isMet to !!_npc.isMet>>
<<set _wasUnknown to !!_npc.isUnknown>>
<<set _sexualAdvanceFlag to false>>
<<set _playerHarassedFlag to false>>
<<set _playerForcedFlag to false>>
<div class="encounter-interaction">
<h3>
<<if !_isMet>>
Approaching a stranger...
<<elseif _npc.isRelative>>
Approaching <<print _npc.fullname>> — a familiar face...
<<else>>
Approaching <<print _npc.fullname>>...
<</if>>
</h3>
<div class="encounter-portrait-large">
<<if _npc.enemyimage and _npc.enemyregion>>
<img @src="'images/NPC/' + _npc.gender + '/' + _npc.npcPortrait + '.webp'" width="80%" class="location-bg">
<<else>>
<div class="portrait-placeholder">❓</div>
<</if>>
</div>
<div id="interaction-result"></div>
<div id="choice-container">
<<if !_isMet>>
<<link "Introduce yourself">>
<<set _npc.isMet to true>>
<<set _npc.isUnknown to false>>
<<set _npc.NPClocation to $PlayerLocation>>
<<if !$known_npc_list.some(n => n.id === _npc.id)>>
<<AddNPCWithFamily _npc>>
<<else>>
<<set _idx to $known_npc_list.findIndex(n => n.id === _npc.id)>>
<<set $known_npc_list[_idx].isMet to true>>
<<set $known_npc_list[_idx].isUnknown to false>>
<<run Object.assign($known_npc_list[_idx], _npc)>>
<</if>>
/* Refresh the page to show the new interaction menu */
<<run Engine.play(passage())>>
<</link>>
<<else>>
<!-- ========== NPC-INITIATED HARASSMENT (can escalate to forced sex) ========== -->
<<set _randomchance to random(1,100)>>
<<if _randomchance lt 20>>
<<set _npcWantsHarass to (
(_npc.depravity > 60) or
(["Wicked","Evil","Selfish"].includes(_npc.internalTrait)) or
(["Power-hungry","Self centered"].includes(_npc.externalTrait)) or
($corruption > 20 and _npc.depravity > 40)
)>>
<<if not _playerHarassedFlag and _npcWantsHarass>>
<<link "??? (something feels off)">>
<<set _playerHarassedFlag = true>>
<<set _roll to random(1,100)>>
<<set _baseChance to 40 + (_npc.depravity / 2) - ($corruption / 2) - ($charisma / 2)>>
<<set _chance to Math.max(10, Math.min(90, _baseChance))>>
<<set _text = "">>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 0>>
<<set _npcDepravityChange = 0>>
<<set _forcedSex = false>>
<<if _roll lt _chance>>
<<set _harassType to random(1,6)>> <!-- 6 variants now -->
<<if _harassType eq 1>>
<img src="images/Sex/waistgrab.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} steps close, grabbing your waist with both hands. <span class="${_npc.gender}">"So tempting,"</span> they whisper, squeezing your ${_npc.gender eq "male" ? "hips" : "rear"} roughly.`>>
<<elseif _harassType eq 2>>
<img src="images/Sex/kissing.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} presses you against the wall, their lips crushing yours in a forceful kiss. Their tongue invades your mouth without consent.`>>
<<elseif _harassType eq 3>>
<img src="images/Sex/titgrab.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} pulls at your robes, exposing your shoulder. <span class="${_npc.gender}">"I've been wanting this for a while,"</span> they growl, groping your chest.`>>
<<elseif _harassType eq 4>>
<img src="images/Sex/thighgrab.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} slides a hand under your robes, fingers brushing against your inner thigh. <span class="${_npc.gender}">"Don't make a sound,"</span> they murmur.`>>
<<elseif _harassType eq 5>>
<img src="images/Sex/grinding.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} turns you around, pressing their body against yours, grinding their ${_npc.gender eq "male" ? "hardness" : "hips"} against you. <span class="${_npc.gender}">"You'll learn to enjoy this."</span>`>>
<<else>>
<img src="images/Sex/waistgrab1.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} grabs your wrist and pulls you close, their other hand groping your backside. <span class="${_npc.gender}">"What a delicious little cultivator."</span>`>>
<</if>>
<<set _friendshipChange = -15>>
<<set _npcDepravityChange = 5>>
<<set _corruptionChange = 3>>
<!-- Chance to escalate to forced sex if NPC is very depraved and not much weaker -->
<<if _npc.depravity > 51 and _npc.power >= $playerPower - 1>>
<<set _forceRoll = random(1,100)>>
<<if _forceRoll lt 30>>
<<set _forcedSex = true>>
<<set _text += ` Before you can react, they overpower you, dragging you into the shadows. <span class="${_npc.gender}">"I'll take what I want,"</span> they snarl.`>>
<<set _friendshipChange = -30>>
<<set _corruptionChange = 10>>
<<set _npcDepravityChange = 8>>
<</if>>
<</if>>
<<if $corruption > 60>>
<<set _text += ` Your body betrays you with a shiver of pleasure. They notice and smirk.`>>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 8>>
<<elseif $corruption > 30>>
<<set _text += ` You manage to push them away, but your pulse races.`>>
<<else>>
<<set _text += ` You shove them back, face red with anger. <span class="player">"Get away!"</span>`>>
<</if>>
<<else>>
<<set _text = `${_npc.fullname} looks at you hungrily, but seems to reconsider. They step back, muttering <span class="${_npc.gender}">"Not now..."</span>`>>
<<set _friendshipChange = -5>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += _npcDepravityChange>>
<<break>>
<</if>>
<</for>>
<<set $corruption += _corruptionChange>>
<<if _forcedSex>>
<<set $sexPartner = _npc>>
<<set $sexType = "forced_npc">>
<<goto "EncounterInteractionSex">>
<<else>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p><<print _text>></p>
<p class="cyan-text">✦ Friendship: <<if _friendshipChange gt 0>>+<</if>><<print _friendshipChange>> | Corruption: +<<print _corruptionChange>> | NPC depravity: +<<print _npcDepravityChange>> ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</if>>
<</link>>
<</if>>
<</if>>
<!-- ========== PLAYER AGGRESSIVE OPTIONS (unchanged except using power) ========== -->
<<if $corruption gt 30 and $playerPower gt _npc.power>>
<<link "Intimidate">>
<<set _roll to random(1,100)>>
<<set _chance to 40 + ($corruption / 2) + ($charisma / 2) - (_npc.depravity / 2)>>
<<set _friendshipChange = 0>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<<if _roll lt _chance>>
<<set _friendshipChange = -10>>
<<set $corruption += 2>>
<p>You flare your aura, letting your cultivation pressure bear down on <<print _npc.name>>. They pale, stammering apologies, hands trembling.</p>
<p class="warning-text">✦ Friendship decreased, corruption increased. ✦</p>
<<else>>
<<set _friendshipChange = 5>>
<p>You try to pressure them, but they refuse to yield, meeting your eyes with defiance.</p>
<p class="cyan-text">✦ They are not impressed. ✦</p>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<break>>
<</if>>
<</for>>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<</if>>
<<if $corruption gt 40>>
<<link "Grope">>
<<set _roll to random(1,100)>>
<<set _chance to 40 + ($corruption / 2) + (($playerPower - _npc.power) * 10)>>
<<set _text = "">>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 0>>
<<set _npcDepravityChange = 0>>
<<if _roll lt _chance>>
<<if _npc.gender eq "male">>
<<set _text = `You boldly run your hand down ${_npc.fullname}'s chest, fingers brushing over their hardening nipples. They gasp but don't pull away.`>>
<<else>>
<<set _text = `You reach around and cup ${_npc.fullname}'s ass, squeezing firmly. They inhale sharply but lean into your touch.`>>
<</if>>
<<set _friendshipChange = -5>>
<<set _corruptionChange = 4>>
<<set _npcDepravityChange = 3>>
<<if random(1,100) < _npc.depravity>>
<<set _text += ` Instead of resisting, they press against you, a hungry moan escaping their lips.`>>
<<set _friendshipChange = 2>>
<</if>>
<<else>>
<<set _text = `Your hand is slapped away. ${_npc.fullname}'s face twists in disgust. <span class="${_npc.gender}">"How dare you!"</span>`>>
<<set _friendshipChange = -15>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += _npcDepravityChange>>
<<break>>
<</if>>
<</for>>
<<set $corruption += _corruptionChange>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p><<print _text>></p>
<p class="cyan-text">✦ Friendship: <<if _friendshipChange gt 0>>+<</if>><<print _friendshipChange>> | Corruption: +<<print _corruptionChange>> | NPC depravity: +<<print _npcDepravityChange>> ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<</if>>
<<if $corruption gt 50>>
<<link "Make a bold move">>
<<set _roll to random(1,100)>>
<<set _chance to 30 + ($corruption / 2) + (($playerPower - _npc.power) * 10)>>
<<set _text = "">>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 0>>
<<set _npcDepravityChange = 0>>
<<if _roll lt _chance>>
<<set _text = `You grab ${_npc.fullname} by the waist, pulling them close. Your lips brush their neck, teeth grazing skin. <span class="player">"Don't resist,"</span> you murmur. They shiver, yielding to you.`>>
<<set _friendshipChange = -5>>
<<set _corruptionChange = 6>>
<<set _npcDepravityChange = 4>>
<<set $sexPartner = _npc>>
<<set $sexType = "aggressive_player">>
<<goto "EncounterInteractionSex">>
<<else>>
<<set _text = `${_npc.fullname} pushes you away firmly. <span class="${_npc.gender}">"Enough! I'll not be toyed with."</span>`>>
<<set _friendshipChange = -15>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += _npcDepravityChange>>
<<break>>
<</if>>
<</for>>
<<set $corruption += _corruptionChange>>
<<if not (_roll lt _chance)>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p><<print _text>></p>
<p class="cyan-text">✦ Friendship: <<if _friendshipChange gt 0>>+<</if>><<print _friendshipChange>> | Corruption: +<<print _corruptionChange>> | NPC depravity: +<<print _npcDepravityChange>> ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</if>>
<</link>>
<</if>>
<<if $corruption gt 70 and $playerPower gt (_npc.power + 1)>>
<<link "Overwhelm">>
<<set $maxArousal to 100>>
<<set _roll to random(1,100)>>
<<set _chance to 20 + ($corruption / 2) + ($charisma / 2) - (_npc.depravity / 2)>>
<<set _friendshipChange = 0>>
<<if _roll lt _chance>>
<<set $corruption += 12>>
<<set _friendshipChange = -40>>
<<set $sexPartner = _npc>>
<<set $sexType = "rape_player">>
<<GenerateGrudge _npc "rape">>
<<goto "EncounterInteractionSex">>
<<else>>
<<set _friendshipChange = -25>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p>Your attempt to force them fails when they scream for help. You flee before guards arrive, but your reputation suffers.</p>
<p class="red-text">✦ The encounter ends badly. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += 5>>
<<break>>
<</if>>
<</for>>
<</link>>
<</if>>
<!-- ========== CONSENSUAL SCENES ========== -->
<<link "Flirt">>
<<set _roll to random(1,100)>>
<<set _chance = 40 + ($charisma / 2) + ($corruption / 10) - (_npc.depravity / 5)>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<<if _roll lte _chance>>
<<set _gain to random(5,15)>>
<<set _npc.friendship += _gain>>
<<set $corruption += 1>>
<p>You exchange a few charged words. The mood shifts in your favor.</p>
<<if _npc.depravity > 50>>
<p><span class="${_npc.gender}">${_npc.fullname}</span> gives you a knowing smile. <span class="${_npc.gender}">"Perhaps we could find someplace quieter..."</span></p>
<<link "Accept the invitation">>
<<set $sexPartner = _npc>>
<<set $sexType = "consensual_flirt">>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<p class="gold-text">✦ Success! Friendship increased. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
<</if>>
<<else>>
<<set _npc.friendship -= random(2,5)>>
<p>Your advance is politely rejected.</p>
<<link "Continue" $encounterOriginPassage>><</link>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship = _npc.friendship>>
<<set $known_npc_list[_i].depravity = _npc.depravity>>
<<break>>
<</if>>
<</for>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<<if $corruption gt 50 and _npc.depravity gt 40>>
<<link "Seduce">>
<<set _roll to random(1,100)>>
<<set _chance = 30 + ($charisma / 2) + ($corruption / 2)>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<<if _roll lte _chance>>
<<set _npc.friendship += 25>>
<<set _npc.depravity += 10>>
<<set $corruption += 5>>
<p>You whisper promises in their ear, your hand slipping beneath their robes. They follow you eagerly to a private spot.</p>
<<link "Seize the moment">>
<<set $sexPartner = _npc>>
<<set $sexType = "consensual_seduce">>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<<set _npc.friendship -= 15>>
<p>They recoil in horror. <span class="${_npc.gender}">"Get away from me!"</span></p>
<p class="red-text">✦ Failure. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship = _npc.friendship>>
<<set $known_npc_list[_i].depravity = _npc.depravity>>
<<break>>
<</if>>
<</for>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<</if>>
<<link "Observe from afar">>
<<set $insight += 1>>
<<set _npc.friendship += 2>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += 2>>
<<break>>
<</if>>
<</for>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p>You watch <<print _npc.fullname>> from a distance and learn a little more about them.</p>
<p class="cyan-text">✦ Insight +1 | Friendship +2 ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<<link "Back" $encounterOriginPassage>><</link>>
<</if>>
</div>
</div>
<</if>><<set _partner to $sexPartner>>
<<set _type to $sexType>>
<<set _dominance to $dominance>>
<<set _returnPassage to $sexReturnPassage ?? $encounterOriginPassage>>
<<if not $maxArousal>>
<<set $maxArousal = 100>>
<</if>>
<div id="casualSexContainer">
<<if _type eq "forced_npc">>
<<CasualSex _partner "vengeance" "sub" "full" _returnPassage null _type>>
<<elseif _type eq "aggressive_player">>
<<CasualSex _partner "dominance" "dom" "full" _returnPassage null _type>>
<<elseif _type eq "rape_player">>
<<CasualSex _partner "cruelty" "dom" "full" _returnPassage null _type>>
<<elseif _type eq "consensual_flirt">>
<<CasualSex _partner "affection" "neutral" "full" _returnPassage null _type>>
<<elseif _type eq "consensual_seduce">>
<<CasualSex _partner "seduction" "neutral" "full" _returnPassage null _type>>
<<elseif _type eq "revenge_victory">>
<<CasualSex _partner "triumph" "dom" "full" _returnPassage null _type>>
<<elseif _type eq "revenge_loss">>
<<CasualSex _partner "humiliation" "sub" "full" _returnPassage null _type>>
<<elseif _type eq "brothel_hire">>
<<CasualSex _partner "pleasure" "neutral" "full" _returnPassage null _type>>
<<elseif _type eq "brothel_work">>
<<CasualSex _partner "service" "sub" "full" _returnPassage null _type>>
<<elseif _type eq "mission_sex">>
<<CasualSex _partner "duty" $missionDominance "full" _returnPassage null _type>>
<<elseif _type eq "merchant">>
<<CasualSex _partner _reason _dominance "full" _returnPassage null _type>>
<<else>>
<<CasualSex _partner "intimacy" "neutral" "full" _returnPassage null "casual">>
<</if>>
</div><<link "go back" "Map|Region1">><</link>>
<<if $pe eq 0>>
\<<CreateNPC_Region1>>\
You've met _fullname
<<set _currenthealthNPC to _maxhealthNPC>>
<<set _currentenergyNPC to _maxenergyNPC>>
_intTrait
_extTrait
_cultivation
_currenthealthNPC / _maxhealthNPC
_currentenergyNPC / _maxenergyNPC
<<BeforeBattle>>
<<link "Battle1" "Battle1">><<set $passage to "Battle1">><<set $pe=0>><</link>>
[[x->HpLowEncounter][$pe=1]]
<<elseif $pe eq 1>>
You are fighting <<print $currentEnemy.fullname>>
Cultivation: <<print $currentEnemy.realm>>
HP: <<print $currentEnemy.NPCcurrenthealth>> / <<print $currentEnemy.NPCmaxhealth>>
Energy: <<print $currentEnemy.NPCcurrentenergy>> / <<print $currentEnemy.NPCmaxenergy>>
[[x2->HpLowEncounter][$pe=2]]
<<elseif $pe eq 2>>
<<if $health lte 0>>
You've lost!
<<elseif $currentEnemy.NPCcurrenthealth lte 0>>
You've won!
Do you want to
<<link "Kill enemy" "HpLowEncounter">> <<set $pe to 3>><</link>>
<<link "Humiliate enemy" "HpLowEncounter">> <<set $pe to 4>><</link>>
<<link "Spare him" "HpLowEncounter">><<set $pe to 5>><</link>>
<<else>>
<<PlayerTurn>>
<<EnemyTurn>>
<</if>>
[[contine->HpLowEncounter][$pe=1]]
<<elseif $pe eq 3>>
You've killed $currentEnemy.fullname
You gained some of his items!
<<link "Continue" "Map|Region1">>
<<set $pe to 0>><</link>>
<<elseif $pe eq 4>>
$currentEnemy.fullname won't forget this humiliation! He may seek revenge later!
<<set $currentEnemy.friendship to -5>>
<<set $currentEnemy.relationshipType to "rival">>
<<link "Continue" "Map|Region1">> <<BattleAddNPC>> <<set $pe to 0>><</link>>
<<elseif $pe eq 5>>
$currentEnemy.fullname is gratefull for your action! He will remember this!
<<set $currentEnemy.friendship to 1>>
<<set $currentEnemy.relationshipType to "friend">>
<<link "Continue" "Map|Region1">> <<set $pe to 0>><<BattleAddNPC>> <</link>>
<</if>><<if $pe eq 0>>
<<set _grudge to $currentRevengeGrudge>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _grudge.avengerId; })>>
/* Failsafe origin passage */
<<set $encounterOriginPassage to $encounterOriginPassage || "Map|Region1">>
<div class="encounter-interaction">
<h3>✦ A Shadow from the Past ✦</h3>
<div class="encounter-portrait-large">
<<if _avenger.enemyimage and _avenger.enemyregion>>
<img @src="'images/' + _avenger.enemyregion + '/' + _avenger.enemyimage + '.jpg'" width="80%">
<<else>>
<div class="portrait-placeholder">⚔️</div>
<</if>>
</div>
<div id="revenge-result" class="result">
<<if _grudge.type eq "rape">>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> blocks your path, eyes burning with fury.</p>
<p><span @class="_avenger.gender">"You defiled <<print _grudge.victimName>>! The heavens may forgive, but I will not!"</span></p>
<<elseif _grudge.type eq "murder">>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> steps forward, grief and rage twisting their features.</p>
<p><span @class="_avenger.gender">"You took <<print _grudge.victimName>> from this world. Prepare to face justice!"</span></p>
<<elseif _grudge.type eq "seduction">>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> confronts you, jealousy burning in their eyes.</p>
<p><span @class="_avenger.gender">"You think you can toy with <<print _grudge.victimName>>'s heart and walk free?"</span></p>
<<else>>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> stands before you, vengeance etched into every line of their face.</p>
<p><span @class="_avenger.gender">"For what you did to <<print _grudge.victimName>>, you will pay!"</span></p>
<</if>>
<<if _avenger.power gt $playerPower>>
<p class="warning-text">Their cultivation surpasses yours. This will be a difficult battle!</p>
<<elseif _avenger.power lt $playerPower>>
<p class="cyan-text">Their cultivation is weaker. Justice may be blind, but power is not.</p>
<</if>>
</div>
<div id="revenge-choices">
<<link "Fight">>
<<set $combatOpponent to _avenger>>
<<set $combatReason to "revenge_grudge">>
<<set $nextPe to 1>>
<<BeforeBattle _avenger>>
<<goto "Battle">>
<</link>>
<<if $charisma gt 30 and $corruption lt 50>>
<<link "Attempt to talk them down">>
<<set _roll to random(1,100)>>
<<set _chance to 20 + ($charisma / 2) + ($righteousreputation / 10) - (_grudge.severity * 3)>>
<<replace "#revenge-result">>
<div class="result animate-fade-in">
<<if _roll lt _chance>>
<p>You speak of regrets, of the cruelty of fate. <span @class="_avenger.gender"><<print _avenger.fullname>></span> hesitates, their anger wavering.</p>
<p><span @class="_avenger.gender">"...Leave. Before I change my mind."</span></p>
<<set $righteousreputation += 5>>
/* Remove the grudge */
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<br><<link "Leave" $encounterOriginPassage>><</link>>
<<else>>
<p>Your words ring hollow. <span @class="_avenger.gender">"Lies! You will face justice!"</span></p>
<br><<link "Fight">>
<<set $combatOpponent to _avenger>>
<<set $combatReason to "revenge_grudge">>
<<set $nextPe to 1>>
<<BeforeBattle _avenger>>
<<goto "Battle">>
<</link>>
<</if>>
</div>
<</replace>>
<<replace "#revenge-choices">><</replace>>
<</link>>
<</if>>
<<if $corruption gt 60 and $playerPower gt _avenger.power>>
<<link "Crush them utterly">>
<<replace "#revenge-result">>
<div class="result animate-fade-in">
<p>You laugh, unleashing your full cultivation. <span @class="_avenger.gender"><<print _avenger.fullname>></span> is crushed beneath your might.</p>
<p class="warning-text">✦ You have proven that power is the only justice. Your demonic reputation grows. ✦</p>
<<set $demonicreputation += 20>>
<<set $hypocrisyScore += 15>>
<<set _avenger.isDead = true>>
<<set _avenger.deathCause = "revenge_killed">>
<<set _avenger.killedByPlayer = true>>
<<set _avenger.killedInRevenge = true>>
<<set _avenger.deathGrudgeType = _grudge.type>>
<<set _avenger.deathGrudgeVictim = _grudge.victimName>>
<div class="warning-text">You have slain <<print _avenger.fullname>>, who sought vengeance for <<print _grudge.victimName>>.</div>
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<<LogEvent "combat" "Grudge Resolved" `"You have ended the life of " + _avenger.fullname + ", who sought retribution for " + _grudge.victimName + ". Their earthly resentment is extinguished; the cycle of vengeance ends here."` 4>> <p class="cyan-text">✦ The shadow that hunted you is no more. ✦</p>
<br><<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#revenge-choices">><</replace>>
<</link>>
<</if>>
<<if $sectFame gt 50 and $righteousreputation gt 30>>
<<link "Invoke your reputation">>
<<replace "#revenge-result">>
<div class="result animate-fade-in">
<p>You invoke your standing in the cultivation world. <span @class="_avenger.gender"><<print _avenger.fullname>></span> hesitates, aware of the consequences.</p>
<p><span @class="_avenger.gender">"...The sects protect their own. This is not over."</span></p>
/* Delayed, but triggered set to false so it can happen again! */
<<set _grudge.timer to random(20, 60)>>
<<set _grudge.triggered to false>>
<br><<link "Leave" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#revenge-choices">><</replace>>
<</link>>
<</if>>
</div>
</div>
<<elseif $pe eq 1>>
<<set _grudge to $currentRevengeGrudge>>
<<set _avenger to $defeatedEnemy>>
<<set $encounterOriginPassage to $encounterOriginPassage || "Map|Region1">>
<div class="encounter-interaction">
<h3>✦ The Scales of Justice ✦</h3>
<div class="encounter-portrait-large">
<<if _avenger.enemyimage and _avenger.enemyregion>>
<img @src="'images/' + _avenger.enemyregion + '/' + _avenger.enemyimage + '.jpg'" width="80%">
<<else>>
<div class="portrait-placeholder">⚔️</div>
<</if>>
</div>
<div class="result">
<p>You have bested <span @class="_avenger.gender">_avenger.fullname</span> in combat. They lie at your feet, their vengeance shattered.</p>
<p>How do you resolve this?</p>
</div>
<div id="revenge-victory-choices">
<!-- Kill -->
<<link "Kill them">>
<<replace "#revenge-victory-choices">>
<div class="result">
<p>You raise your weapon and end their life. Their eyes meet yours one last time, filled with hate and despair, before the light fades.</p>
<p>As their qi scatters, you feel the weight of another death added to your conscience.</p>
<<set _avenger.isDead = true>>
<<set _avenger.deathCause = "revenge_killed">>
<<set _avenger.killedByPlayer = true>>
<<set _avenger.killedInRevenge = true>>
<<set _avenger.deathGrudgeType = _grudge.type>>
<<set _avenger.deathGrudgeVictim = _grudge.victimName>>
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<<set $demonicreputation += 5>>
<<set $fame += 5>>
<<set $corruption = Math.min(100, $corruption + 3)>>
<<LogEvent "combat" "Grudge Resolved" `"You have ended the life of " + _avenger.fullname + ", who sought retribution for " + _grudge.victimName + ". Their earthly resentment is extinguished; the cycle of vengeance ends here."` 4>> <p class="cyan-text">✦ The shadow that hunted you is no more. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<</link>>
<!-- Spare (mercy) -->
<<link "Spare their life">>
<<replace "#revenge-victory-choices">>
<div class="result">
<p>You lower your weapon. <span class="player">"Go. Your vengeance is futile."</span></p>
<p><span @class="_avenger.gender">_avenger.fullname</span> stares at you, disbelief warring with shame. They stagger to their feet.</p>
<<if _grudge.type eq "rape">>
<p><span @class="_avenger.gender">“You... you think this absolves you?”</span> they spit, but the fire in their eyes is dim.</p>
<<elseif _grudge.type eq "murder">>
<p><span @class="_avenger.gender">“Mercy? You took a life! This changes nothing!” they rasp, but they stumble away.</p>
<<else>>
<p><span @class="_avenger.gender">“This isn't over...”</span> they whisper, but their voice lacks conviction.</p>
<</if>>
<p>They retreat, humbled but not broken. The grudge may fade, or it may smoulder for years.</p>
<<set _grudge.severity = Math.max(1, _grudge.severity - 3)>>
<<set _grudge.timer = random(20, 60)>>
<<set _grudge.triggered = false>>
<<set $righteousreputation += 5>>
<<set $corruption = Math.max(0, $corruption - 2)>>
<p class="cyan-text">✦ Their grudge still simmers, but it may take a long time to reignite. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<</link>>
<!-- Humiliate / NSFW Spare (if avenger depraved or grudge type sexual) -->
<<if $corruption gte 60>>
<<link "Claim them as your prize" "EncounterInteractionSex">>
<<set $sexPartner = _avenger>>
<<set $sexType = "revenge_victory">>
<<set $sexReturnPassage = $encounterOriginPassage>>
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<<set $corruption = Math.min(100, $corruption + 8)>>
<<set $demonicreputation += 10>>
<</link>>
<</if>>
</div>
</div>
<<elseif $pe eq 2>>
<<set _grudge to $currentRevengeGrudge>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _grudge.avengerId; })>>
<<set $encounterOriginPassage to $encounterOriginPassage || "Map|Region1">>
<<set _nsfwLoss = false>>
<div class="encounter-interaction">
<h3>✦ The Debt of Blood ✦</h3>
<div class="encounter-portrait-large">
<<if _avenger.enemyimage and _avenger.enemyregion>>
<img @src="'images/' + _avenger.enemyregion + '/' + _avenger.enemyimage + '.jpg'" width="80%">
<<else>>
<div class="portrait-placeholder">⚔️</div>
<</if>>
</div>
<div class="result">
<<if $playerLost>>
<p>You have been bested. <span class="${_avenger.gender}">${_avenger.fullname}</span> stands over you, their blade at your throat, their eyes blazing with righteous fury.</p>
/* Check for NSFW loss possibility */
<<if _avenger.depravity > 60 and ( _grudge.type eq "rape" or _grudge.type eq "seduction" )>>
<<set _nsfwLoss = true>>
<p>A dark gleam enters their eyes. <span @class="_avenger.gender">"Death would be too merciful,"</span> they murmur. <span @class="_avenger.gender">"Perhaps you need to learn what you've done... firsthand."</span></p>
<<set $sexPartner = _avenger>>
<<set $sexType = "revenge_loss">>
<<set $sexReturnPassage = $encounterOriginPassage>>
<<link "Submit">>
<<goto "EncounterInteractionSex">>
<</link>>
<<elseif _avenger.depravity > 70 or ["Wicked","Evil","Power-hungry"].includes(_avenger.internalTrait) or ["Power-hungry","Self centered"].includes(_avenger.externalTrait)>>
<<set _nsfwLoss = true>>
<p>They sheathe their weapon, a cruel smile playing on their lips. <span @class="_avenger.gender">"There are worse fates than death,"</span> they say. <span @class="_avenger.gender">"You will repay your debt... with your body."</span></p>
<<set $sexPartner = _avenger>>
<<set $sexType = "revenge_loss">>
<<set $sexReturnPassage = $encounterOriginPassage>>
<<link "Submit">>
<<goto "EncounterInteractionSex">>
<</link>>
<</if>>
<<if not _nsfwLoss>>
<<if _grudge.type eq "rape">>
<p><span @class="_avenger.gender">“Now you know how it feels to be powerless,”</span> they snarl. <span @class="_avenger.gender">“For what you did to <span class="${_avenger.gender}">${_grudge.victimName}</span>, I should end you here. But death is too kind.”</span></p>
<p>They leave you broken and humiliated, a mark of your shame forever carved into your reputation.</p>
<<set $demonicreputation += 5>>
<<set $publicReputation -= 10>>
<<set $health = Math.floor($health * 0.5)>>
<<set $corruption = Math.min(100, $corruption + 3)>>
<<LogEvent "reputation" "Public Shaming" "You were defeated by " + _avenger.fullname + ", who sought revenge for " + _grudge.victimName + ". Your reputation suffered." 3>>
<<elseif _grudge.type eq "murder">>
<p><span @class="_avenger.gender">“You took a life. Now you owe a life.”</span> The blade presses deeper, drawing blood. <span @class="_avenger.gender">“But the heavens are watching. Live with your guilt.”</span></p>
<p>They leave you bleeding, but alive – perhaps to let the weight of your crime crush you slowly.</p>
<<set $demonicreputation += 10>>
<<set $publicReputation -= 15>>
<<set $health = Math.floor($health * 0.6)>>
<<set $hypocrisyScore += 8>>
<<LogEvent "combat" "Grudge Defeat" "You were defeated by " + _avenger.fullname + ", avenging " + _grudge.victimName + ". Your shame echoes in the Jianghu." 4>>
<<else>>
<p><span @class="_avenger.gender">“This is your punishment,”</span> they say coldly. <span @class="_avenger.gender">“Let the world know what you've done. Let your shame be your cage.”</span></p>
<p>They walk away, leaving you to crawl back to the world, your pride in tatters.</p>
<<set $fame -= 5>>
<<set $publicReputation -= 5>>
<<set $health = Math.floor($health * 0.7)>>
<<LogEvent "reputation" "Defeated by Rival" "You were bested by " + _avenger.fullname + ", who sought justice for " + _grudge.victimName + "." 3>>
<</if>>
/* Grudge persists or intensifies */
<<set _grudge.severity = Math.min(10, _grudge.severity + 2)>>
<<set _grudge.timer = random(15, 45)>>
<<set _grudge.triggered = false>>
<p class="warning-text">✦ Their grudge has deepened. They will surely seek you out again. ✦</p>
<</if>>
<</if>>
<<if not _nsfwLoss>>
<<link "Return, wounded" $encounterOriginPassage>><</link>>
<</if>>
</div>
</div>
<</if>><<set $itemList to []>>
<<run Object.keys(State.variables).forEach(function(key){
let obj = State.variables[key];
if (obj && typeof obj === "object" && obj.class === "item") {
State.variables.itemList.push(obj);
}
})>>
<<set $vitalityelixirrecipe to {
"name": "Vitality Elixir",
"bloodhardeningherb": 1,
"vitalityroot": 2,
"result": {
"id": "vitalityelixir",
"name": "Vitality Elixir",
"description": "Restores vitality and inner balance.",
"effect": "restoreHealth",
"quantity": 1,
"class": "potion"
}
}>><div class="elixir-pouch-container">
<div class="inventory-header">
<h2>Your Elixir Pouch</h2>
<p>Precious pills and spiritual elixirs gathered on your path to immortality.</p>
</div>
<div id="log"></div>
<<if $playerpotioninventory.length gt 0>>
<table class="elixir-inventory-table">
<thead>
<tr>
<th style="width: 80px;"></th>
<th>Elixir</th>
<th style="width: 100px; text-align: center;">Grade</th>
<th style="width: 100px; text-align: center;">Quantity</th>
<th style="width: 120px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _potion range $playerpotioninventory>>
<<set _rarityColor to
(_potion.grade <= 1 ? "#4fc3f7" :
_potion.grade <= 3 ? "#66bb6a" :
_potion.grade <= 5 ? "#ffa726" :
"#ab47bc") >> <!-- Blue → Green → Orange → Purple -->
<tr class="elixir-row">
<td style="text-align: center;">
<div class="elixir-icon">丹</div> <!-- Replace with <img src="your-icon-url.png"> later -->
</td>
<td>
<div class="item-name" style="color: <<print _rarityColor>>;"><<print _potion.name>></div>
<<if _potion.description neq null>>
<div class="item-desc"><<print _potion.description>></div>
<</if>>
</td>
<td style="text-align: center; color: <<print _rarityColor>>; font-weight: bold;">
Grade <<print _potion.grade>>
</td>
<td style="text-align: center;">
<div class="quantity-glow"><<print _potion.quantity>></div>
</td>
<td style="text-align: center;">
<<link "Consume">>
<<set $selectedPotion to _potion>>
<<if _potion.quantity lte 0>>
<<set $playerpotioninventory.deleteAt($playerpotioninventory.indexOf(_potion))>>
<</if>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Spiritual qi surges!</span><br>
You consume the <<print _potion.name>>. A warm current flows through your meridians...
</div>
<</replace>>
<<useItem>> <!-- Apply your custom effect macro here -->
<</link>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-pouch">
<p>Your elixir pouch is empty.</p>
<p>Seek out rare spirit-herbs and profound catalysts to sustain your journey toward immortality.</p>
</div>
<</if>>
<div id="use-log" class="log-area"></div>
</div>
<</if>>
<</nobr>><<set $strengthboostrecipe1 to {
"name": "Strength Boost Pill (Grade 1)",
"ingredients": {
"Tempered Bone Fragment": 1,
"Blood Hardening Herb": 2
},
"result": $strengthboostpotion1
}>>
/* ═══════════════════════════════════════
STRENGTH RECIPES
merchantCost: common category, slight discount vs baseline
G1: 250 | G2: 450 | G3: 900 | G4: 2200 | G5: 4500
═══════════════════════════════════════ */
/* Grade 1 already exists: $strengthboostrecipe1 — add merchantCost manually: 250 */
<<set $strengthboostrecipe2 to {
"name": "Strength Boost Pill (Grade 2)",
"merchantCost": 450,
"ingredients": {
"Tempered Bone Fragment": 2,
"Blood Hardening Herb": 2,
"Beast Sinew Fiber": 1,
"Iron Core Husk": 1
},
"result": $strengthboostpotion2
}>>
<<set $strengthboostrecipe3 to {
"name": "Strength Boost Pill (Grade 3)",
"merchantCost": 900,
"ingredients": {
"Mountain Ox Tendon": 2,
"Ironblood Lotus Seed": 2,
"Beast Sinew Fiber": 2,
"Crimson Hide Flake": 1,
"Solar Stone Powder": 1
},
"result": $strengthboostpotion3
}>>
<<set $strengthboostrecipe4 to {
"name": "Strength Boost Pill (Grade 4)",
"merchantCost": 2200,
"ingredients": {
"Dragonbone Dust": 2,
"Titan Ape Hair": 2,
"Golden Marrow Fragment": 2,
"Vitality Root": 2,
"Thunder Lizard Hide": 1,
"Mountain Ox Tendon": 1
},
"result": $strengthboostpotion4
}>>
<<set $strengthboostrecipe5 to {
"name": "Strength Boost Pill (Grade 5)",
"merchantCost": 4500,
"ingredients": {
"Phoenix Blood Flake": 2,
"Molten Gold Dew": 1,
"Titan Ape Hair": 2,
"Dragonbone Dust": 2,
"Golden Marrow Fragment": 2,
"Heavenly Ember Flower": 2,
"Solar Stone Powder": 2
},
"result": $strengthboostpotion5
}>>
/* ═══════════════════════════════════════
AGILITY RECIPES
merchantCost: standard baseline
G1: 300 | G2: 600 | G3: 1100 | G4: 2800 | G5: 5500
═══════════════════════════════════════ */
<<set $agilityboostrecipe1 to {
"name": "Wind Step Pill (Grade 1)",
"merchantCost": 300,
"ingredients": {
"Swiftwind Feather": 2,
"Rising Mist Herb": 1
},
"result": $agilityboostpotion1
}>>
<<set $agilityboostrecipe2 to {
"name": "Wind Step Pill (Grade 2)",
"merchantCost": 600,
"ingredients": {
"Swiftwind Feather": 2,
"Shadow Step Moss": 2,
"Cloud Step Extract": 1,
"Spirit Vine Tendril": 1
},
"result": $agilityboostpotion2
}>>
<<set $agilityboostrecipe3 to {
"name": "Wind Step Pill (Grade 3)",
"merchantCost": 1100,
"ingredients": {
"Cloud Step Extract": 2,
"Shadow Step Moss": 2,
"Lightning Step Tendon": 1,
"Serpent Mark Scale": 1,
"Wind Vein Powder": 1
},
"result": $agilityboostpotion3
}>>
<<set $agilityboostrecipe4 to {
"name": "Void Stride Pill (Grade 4)",
"merchantCost": 2800,
"ingredients": {
"Lightning Step Tendon": 2,
"Void Stride Essence": 2,
"Serpent Mark Scale": 2,
"Wind Vein Powder": 2,
"Cloud Step Extract": 1,
"Voidstorm Tear": 1
},
"result": $agilityboostpotion4
}>>
<<set $agilityboostrecipe5 to {
"name": "Void Stride Pill (Grade 5)",
"merchantCost": 5500,
"ingredients": {
"Void Stride Essence": 2,
"Voidstorm Tear": 2,
"Lightning Step Tendon": 2,
"Celestial Core Crystal": 2,
"Origin Qi Flake": 1,
"Molten Gold Dew": 1,
"True Mist Heart": 1
},
"result": $agilityboostpotion5
}>>
/* ═══════════════════════════════════════
WILLPOWER RECIPES
merchantCost: standard baseline
G1: 300 | G2: 650 | G3: 1200 | G4: 2900 | G5: 5800
═══════════════════════════════════════ */
<<set $willpowerboostrecipe1 to {
"name": "Iron Will Pill (Grade 1)",
"merchantCost": 300,
"ingredients": {
"Cinnabar Heart Stone": 1,
"Empty Mind Herb": 2
},
"result": $willpowerboostpotion1
}>>
<<set $willpowerboostrecipe2 to {
"name": "Iron Will Pill (Grade 2)",
"merchantCost": 650,
"ingredients": {
"Cinnabar Heart Stone": 2,
"Stillwater Pearl Powder": 2,
"Empty Mind Herb": 1,
"Meditation Dust": 1
},
"result": $willpowerboostpotion2
}>>
<<set $willpowerboostrecipe3 to {
"name": "Diamond Mind Pill (Grade 3)",
"merchantCost": 1200,
"ingredients": {
"Stillwater Pearl Powder": 2,
"Moonlit Jade Fragment": 2,
"Cinnabar Heart Stone": 2,
"Refined Spirit Water": 1,
"River Pearl Scale": 1
},
"result": $willpowerboostpotion3
}>>
<<set $willpowerboostrecipe4 to {
"name": "Diamond Mind Pill (Grade 4)",
"merchantCost": 2900,
"ingredients": {
"Soul Mirror Crystal": 2,
"Moonlit Jade Fragment": 2,
"Divine Pulse Stone": 2,
"Stillwater Pearl Powder": 2,
"Astral Dewdrop": 1,
"Heavenly Ember Flower": 1
},
"result": $willpowerboostpotion4
}>>
<<set $willpowerboostrecipe5 to {
"name": "Heaven's Resolve Pill (Grade 5)",
"merchantCost": 5800,
"ingredients": {
"Soul Mirror Crystal": 2,
"Void Meridian Core": 2,
"Astral Dewdrop": 2,
"Moonlit Jade Fragment": 2,
"Qi Dragon Pearl": 2,
"Molten Gold Dew": 1,
"Origin Qi Flake": 1
},
"result": $willpowerboostpotion5
}>>
/* ═══════════════════════════════════════
CHARISMA RECIPES
merchantCost: standard baseline
G1: 280 | G2: 600 | G3: 1150 | G4: 2800
═══════════════════════════════════════ */
/* Grade 1: succubusbreath uses boostCharisma — recipe below */
<<set $succubusbreathrecipe to {
"name": "Succubus Breath Mist",
"merchantCost": 280,
"ingredients": {
"Rose Dew Honey": 2,
"Spirit Vine Tendril": 1
},
"result": $succubusbreath
}>>
<<set $charismaboostrecipe2 to {
"name": "Jade Aura Pill (Grade 2)",
"merchantCost": 600,
"ingredients": {
"Jade Petal Powder": 2,
"Rose Dew Honey": 2,
"Silvertongue Root": 1,
"Clearwater Extract": 1
},
"result": $charismaboostpotion2
}>>
<<set $charismaboostrecipe3 to {
"name": "Phoenix Grace Pill (Grade 3)",
"merchantCost": 1150,
"ingredients": {
"Phoenix Coil Perfume": 2,
"Jade Petal Powder": 2,
"Silvertongue Root": 2,
"Jade Gathering Thread": 1,
"Sunheart Bark": 1
},
"result": $charismaboostpotion3
}>>
<<set $charismaboostrecipe4 to {
"name": "Sovereign Presence Pill (Grade 4)",
"merchantCost": 2800,
"ingredients": {
"Phoenix Coil Perfume": 2,
"Heavenly Ember Flower": 2,
"Silvertongue Root": 2,
"Phoenix Blood Flake": 1,
"Jade Petal Powder": 2,
"Astral Dewdrop": 1
},
"result": $charismaboostpotion4
}>>
/* ═══════════════════════════════════════
LUCK RECIPES
merchantCost: +30-50% premium (unpredictable, hard to source)
G1: 380 | G2: 850 | G3: 1900
═══════════════════════════════════════ */
<<set $luckboostrecipe1 to {
"name": "Fortune Mist Pill (Grade 1)",
"merchantCost": 380,
"ingredients": {
"Fortune Mist Seed": 2,
"Rising Mist Herb": 1
},
"result": $luckboostpotion1
}>>
<<set $luckboostrecipe2 to {
"name": "Fortune Mist Pill (Grade 2)",
"merchantCost": 850,
"ingredients": {
"Fortune Mist Seed": 2,
"Prophet's Eye Flower": 2,
"Moonlight Shell": 1,
"Clearwater Extract": 1
},
"result": $luckboostpotion2
}>>
<<set $luckboostrecipe3 to {
"name": "Heaven's Chosen Pill (Grade 3)",
"merchantCost": 1900,
"ingredients": {
"Destiny Thread Fragment": 2,
"Prophet's Eye Flower": 2,
"Fortune Mist Seed": 2,
"Astral Dewdrop": 1,
"Qi Dragon Pearl": 1,
"Nine Leaf Lotus": 1
},
"result": $luckboostpotion3
}>>
/* ═══════════════════════════════════════
INSIGHT RECIPES
merchantCost: standard baseline
G1: 320 | G2: 700 | G3: 1300
═══════════════════════════════════════ */
<<set $insightboostrecipe1 to {
"name": "Clear Eye Pill (Grade 1)",
"merchantCost": 320,
"ingredients": {
"Prophet's Eye Flower": 1,
"Stone Pulse Pebble": 2
},
"result": $insightboostpotion1
}>>
<<set $insightboostrecipe2 to {
"name": "Clear Eye Pill (Grade 2)",
"merchantCost": 700,
"ingredients": {
"Prophet's Eye Flower": 2,
"Bright Meridian Crystal": 2,
"Stone Pulse Pebble": 1,
"Meditation Dust": 1
},
"result": $insightboostpotion2
}>>
<<set $insightboostrecipe3 to {
"name": "Heaven-Sight Pill (Grade 3)",
"merchantCost": 1300,
"ingredients": {
"Destiny Thread Fragment": 1,
"Prophet's Eye Flower": 2,
"Divine Pulse Stone": 2,
"Bright Meridian Crystal": 2,
"Astral Dewdrop": 1
},
"result": $insightboostpotion3
}>>
/* ═══════════════════════════════════════
MAX HEALTH RECIPES
merchantCost: standard baseline
G1: 270 | G2: 580 | G3: 1100 | G4: 2600
═══════════════════════════════════════ */
<<set $maxhealthrecipe1 to {
"name": "Life Sea Pill (Grade 1)",
"merchantCost": 270,
"ingredients": {
"Green Spirit Sap": 2,
"Vitality Root": 1
},
"result": $maxhealthpotion1
}>>
<<set $maxhealthrecipe2 to {
"name": "Life Sea Pill (Grade 2)",
"merchantCost": 580,
"ingredients": {
"Blood Lotus Petal": 2,
"Green Spirit Sap": 2,
"Ironblood Lotus Seed": 1,
"Blood Hardening Herb": 1
},
"result": $maxhealthpotion2
}>>
<<set $maxhealthrecipe3 to {
"name": "Undying Foundation Pill (Grade 3)",
"merchantCost": 1100,
"ingredients": {
"Heaven Spring Water": 2,
"Blood Lotus Petal": 2,
"Vitality Root": 2,
"Mountain Ox Tendon": 1,
"Dragonbone Dust": 1
},
"result": $maxhealthpotion3
}>>
<<set $maxhealthrecipe4 to {
"name": "Undying Foundation Pill (Grade 4)",
"merchantCost": 2600,
"ingredients": {
"Undying Phoenix Ash": 2,
"Heaven Spring Water": 2,
"Phoenix Blood Flake": 2,
"Blood Lotus Petal": 2,
"Molten Gold Dew": 1,
"Heavenly Ember Flower": 1
},
"result": $maxhealthpotion4
}>>
/* ═══════════════════════════════════════
MAX ENERGY RECIPES
merchantCost: standard baseline
G1: 260 | G2: 560 | G3: 1050 | G4: 2500
═══════════════════════════════════════ */
<<set $maxenergyrecipe1 to {
"name": "Qi Sea Pill (Grade 1)",
"merchantCost": 260,
"ingredients": {
"Faint Qi Crystal": 2,
"Breathing Moon Moss": 1
},
"result": $maxenergypotion1
}>>
<<set $maxenergyrecipe2 to {
"name": "Qi Sea Pill (Grade 2)",
"merchantCost": 560,
"ingredients": {
"Condensed Qi Stone": 2,
"Tidewater Pearl": 1,
"Breathing Moon Moss": 2,
"Qi-Spun Silk": 1
},
"result": $maxenergypotion2
}>>
<<set $maxenergyrecipe3 to {
"name": "Boundless Sea Pill (Grade 3)",
"merchantCost": 1050,
"ingredients": {
"Tidewater Pearl": 2,
"Qi Dragon Pearl": 2,
"Condensed Qi Stone": 2,
"Nine Leaf Lotus": 1,
"Flowroot Essence": 1
},
"result": $maxenergypotion3
}>>
<<set $maxenergyrecipe4 to {
"name": "Boundless Sea Pill (Grade 4)",
"merchantCost": 2500,
"ingredients": {
"Primordial Mist Drop": 2,
"Celestial Core Crystal": 2,
"Voidstorm Tear": 2,
"Tidewater Pearl": 2,
"Origin Qi Flake": 1,
"True Mist Heart": 1
},
"result": $maxenergypotion4
}>>
/* ═══════════════════════════════════════
LIFESPAN RECIPES
merchantCost: +60-100% premium (most coveted category)
G1: 550 | G2: 1400 | G3: 3600
═══════════════════════════════════════ */
<<set $lifespanrecipe1 to {
"name": "Longevity Root Pill (Grade 1)",
"merchantCost": 550,
"ingredients": {
"Ageless Pine Twig": 2,
"Vitality Root": 2
},
"result": $lifespanpotion1
}>>
<<set $lifespanrecipe2 to {
"name": "Immortal Breath Pill (Grade 2)",
"merchantCost": 1400,
"ingredients": {
"Eternal Moon Resin": 2,
"Ageless Pine Twig": 2,
"Heaven Spring Water": 1,
"Nineleaf Lotus": 1,
"Vitality Root": 1
},
"result": $lifespanpotion2
}>>
<<set $lifespanrecipe3 to {
"name": "Heaven Longevity Pill (Grade 3)",
"merchantCost": 3600,
"ingredients": {
"Heaven Longevity Seed": 2,
"Eternal Moon Resin": 2,
"Molten Gold Dew": 1,
"Undying Phoenix Ash": 2,
"Astral Dewdrop": 1,
"Heavenly Ember Flower": 2
},
"result": $lifespanpotion3
}>>
/* ═══════════════════════════════════════
SPIRITUAL ROOT RECIPES
merchantCost: +40-70% premium (sect-level rarity)
G1: 480 | G2: 1000 | G3: 2100 | G4: 5000
═══════════════════════════════════════ */
<<set $spiritrootrecipe1 to {
"name": "Root Nourishing Pill (Grade 1)",
"merchantCost": 480,
"ingredients": {
"Spirit Vine Tendril": 2,
"Faint Qi Crystal": 2
},
"result": $spiritootpotion1
}>>
<<set $spiritrootrecipe2 to {
"name": "Root Nourishing Pill (Grade 2)",
"merchantCost": 1000,
"ingredients": {
"Bright Meridian Crystal": 2,
"Nine Leaf Lotus": 1,
"Spirit Vine Tendril": 2,
"Jade Gathering Thread": 1
},
"result": $spiritrootpotion2
}>>
<<set $spiritrootrecipe3 to {
"name": "Heaven Root Awakening Pill (Grade 3)",
"merchantCost": 2100,
"ingredients": {
"Void Meridian Core": 2,
"Astral Dewdrop": 1,
"Nine Leaf Lotus": 2,
"Bright Meridian Crystal": 2,
"Qi Dragon Pearl": 1
},
"result": $spiritrootpotion3
}>>
<<set $spiritrootrecipe4 to {
"name": "True Heaven Root Pill (Grade 4)",
"merchantCost": 5000,
"ingredients": {
"Void Meridian Core": 2,
"Celestial Core Crystal": 2,
"Origin Qi Flake": 2,
"Heaven-Drawing Ink": 2,
"Qi Dragon Pearl": 2,
"Molten Gold Dew": 1
},
"result": $spiritrootpotion4
}>>
/* ═══════════════════════════════════════
MARTIAL ARTS RECIPES
merchantCost: standard baseline
G1: 300 | G2: 680 | G3: 1350
═══════════════════════════════════════ */
<<set $martialartsrecipe1 to {
"name": "Battle Sense Pill (Grade 1)",
"merchantCost": 300,
"ingredients": {
"Cinnabar Heart Stone": 1,
"Serpent Pulse Salve": 1,
"Meditation Dust": 1
},
"result": $martialartspotionpotion1
}>>
<<set $martialartsrecipe2 to {
"name": "Battle Sense Pill (Grade 2)",
"merchantCost": 680,
"ingredients": {
"Serpent Mark Scale": 1,
"Lightning Step Tendon": 1,
"Cinnabar Heart Stone": 2,
"Inner Flame Core": 1,
"Thunderweed": 1
},
"result": $martialartspotionpotion2
}>>
<<set $martialartsrecipe3 to {
"name": "Unrivalled Form Pill (Grade 3)",
"merchantCost": 1350,
"ingredients": {
"Soul Mirror Crystal": 1,
"Lightning Step Tendon": 2,
"Void Stride Essence": 1,
"Divine Pulse Stone": 2,
"Inner Flame Core": 2,
"Thunderweed": 1
},
"result": $martialartspotionpotion3
}>>
/* ═══════════════════════════════════════
ARMOR RECIPES
merchantCost: common category, slight discount vs baseline
G1: 220 | G2: 480 | G3: 950
═══════════════════════════════════════ */
<<set $armorboostrecipe1 to {
"name": "Iron Skin Pill (Grade 1)",
"merchantCost": 220,
"ingredients": {
"Copper Skin Powder": 2,
"Tempered Bone Fragment": 1
},
"result": $armorboostpotion1
}>>
<<set $armorboostrecipe2 to {
"name": "Iron Skin Pill (Grade 2)",
"merchantCost": 480,
"ingredients": {
"Crimson Hide Flake": 2,
"Thunder Lizard Hide": 2,
"Copper Skin Powder": 1,
"Burning Sand Resin": 1
},
"result": $armorboostpotion2
}>>
<<set $armorboostrecipe3 to {
"name": "Stone Shell Pill (Grade 3)",
"merchantCost": 950,
"ingredients": {
"Thunder Lizard Hide": 2,
"Dragonbone Dust": 2,
"Burning Sand Resin": 2,
"Golden Marrow Fragment": 1,
"Crimson Hide Flake": 1
},
"result": $armorboostpotion3
}>>
/* ═══════════════════════════════════════
CORRUPTION RECIPES
merchantCost: +20-40% premium (forbidden, dangerous to sell)
Most alchemists won't carry these at all — the ones who do charge
for the risk. G1: 280 | G2: 580 | G3: 1100 | G4: 2800 | G5: 5200
═══════════════════════════════════════ */
<<set $corruptionrecipe1 to {
"name": "Tainted Dew Drop",
"merchantCost": 280,
"ingredients": {
"Demonic Qi Dust": 2,
"Heart Devil Weed": 1
},
"result": $corruptionelixir1
}>>
/* Grade 2: corruptionelixir (Heart Demon Nectar) */
<<set $corruptionrecipe2 to {
"name": "Heart Demon Nectar",
"merchantCost": 580,
"ingredients": {
"Heart Devil Weed": 2,
"Dusk Blood Moss": 2,
"Demonic Qi Dust": 1,
"Shadow Lust Pollen": 1
},
"result": $corruptionelixir
}>>
/* Grade 3: forbiddenyangseed (Forbidden Yang Seed) */
<<set $corruptionrecipe3 to {
"name": "Forbidden Yang Seed",
"merchantCost": 1100,
"ingredients": {
"Shadow Lust Pollen": 2,
"Demon Bile Extract": 2,
"Heart Devil Weed": 2,
"Taboo Flesh Seal": 1
},
"result": $forbiddenyangseed
}>>
<<set $corruptionrecipe4 to {
"name": "Abyss Communion Draft",
"merchantCost": 2800,
"ingredients": {
"Abyssal Heart Core": 2,
"Sin Flesh Powder": 2,
"Taboo Flesh Seal": 2,
"Demon Bile Extract": 2,
"Void Corruption Tear": 1
},
"result": $corruptionelixir4
}>>
<<set $corruptionrecipe5 to {
"name": "Void Demon Ascension Elixir",
"merchantCost": 5200,
"ingredients": {
"Void Corruption Tear": 2,
"Abyssal Heart Core": 2,
"Sin Flesh Powder": 2,
"Shadow Lust Pollen": 2,
"Demon Bile Extract": 2,
"Heart Devil Weed": 2
},
"result": $corruptionelixir5
}>><<set $strengthboostpotion1 to {
"id": "strengthboostpotion1",
"name": "Strength Boost Pill (Grade 1)",
"description": "Temporarily boosts strength. Grade 1 effective up to STR 15.",
"effect": "boostStrength",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 150,
"sellprice": 60,
"tag": "Strength"
}>>
<<set $corruptionelixir to {
"id": "corruptionelixir",
"name": "Heart Demon Nectar",
"description": "Sweet demonic essence that loosens moral restraints and awakens hidden desires. Slightly increases demonic path affinity.",
"effect": "raiseCorruption",
"grade": 2,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 300,
"sellprice": 75,
"tag": "Corruption"
}>>
<<set $succubusbreath to {
"id": "succubusbreath",
"name": "Succubus Breath Mist",
"description": "Inhaled vapors that temporarily heighten charm and make your voice more seductive. Others find it hard to refuse you.",
"effect": "boostCharisma",
"grade": 1,
"maxStatLimit": 20,
"quantity": 1,
"class": "potion",
"price": 250,
"sellprice": 62,
"tag": "Charisma"
}>>
<<set $forbiddenyangseed to {
"id": "forbiddenyangseed",
"name": "Forbidden Yang Seed",
"description": "A single drop of concentrated yang essence. Greatly increases corruption and demonic tendencies over time.",
"effect": "deepCorruption",
"grade": 3,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 500,
"sellprice": 125,
"tag": "Corruption"
}>>
/* ═══════════════════════════════════════════
STRENGTH POTIONS — Grades 1–5
═══════════════════════════════════════════ */
/* Grade 1 already exists: $strengthboostpotion1 */
<<set $strengthboostpotion2 to {
"id": "strengthboostpotion2",
"name": "Strength Boost Pill (Grade 2)",
"description": "Hardens muscle and bone, permanently improving physical power. Grade 2 effective up to STR 25.",
"effect": "boostStrength",
"grade": 2,
"maxStatLimit": 25,
"quantity": 1,
"class": "potion",
"price": 280,
"sellprice": 112,
"tag": "Strength"
}>>
<<set $strengthboostpotion3 to {
"id": "strengthboostpotion3",
"name": "Strength Boost Pill (Grade 3)",
"description": "Reshapes the cultivator's musculature at a deep level. Grade 3 effective up to STR 40.",
"effect": "boostStrength",
"grade": 3,
"maxStatLimit": 40,
"quantity": 1,
"class": "potion",
"price": 500,
"sellprice": 200,
"tag": "Strength"
}>>
<<set $strengthboostpotion4 to {
"id": "strengthboostpotion4",
"name": "Strength Boost Pill (Grade 4)",
"description": "A rare pill that tempers the body to near-spirit beast levels. Grade 4 effective up to STR 60.",
"effect": "boostStrength",
"grade": 4,
"maxStatLimit": 60,
"quantity": 1,
"class": "potion",
"price": 900,
"sellprice": 360,
"tag": "Strength"
}>>
<<set $strengthboostpotion5 to {
"id": "strengthboostpotion5",
"name": "Strength Boost Pill (Grade 5)",
"description": "A heavenly pill said to grant the strength of an ancient divine beast. Grade 5 effective up to STR 80.",
"effect": "boostStrength",
"grade": 5,
"maxStatLimit": 80,
"quantity": 1,
"class": "potion",
"price": 2000,
"sellprice": 800,
"tag": "Strength"
}>>
/* ═══════════════════════════════════════════
AGILITY POTIONS — Grades 1–5
═══════════════════════════════════════════ */
<<set $agilityboostpotion1 to {
"id": "agilityboostpotion1",
"name": "Wind Step Pill (Grade 1)",
"description": "Lightens the body and quickens footwork. Grade 1 effective up to AGI 15.",
"effect": "boostAgility",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 140,
"sellprice": 56,
"tag": "Agility"
}>>
<<set $agilityboostpotion2 to {
"id": "agilityboostpotion2",
"name": "Wind Step Pill (Grade 2)",
"description": "Refines limb response and body coordination. Grade 2 effective up to AGI 25.",
"effect": "boostAgility",
"grade": 2,
"maxStatLimit": 25,
"quantity": 1,
"class": "potion",
"price": 270,
"sellprice": 108,
"tag": "Agility"
}>>
<<set $agilityboostpotion3 to {
"id": "agilityboostpotion3",
"name": "Wind Step Pill (Grade 3)",
"description": "Infuses the meridians with wind qi, enabling near-instantaneous movement. Grade 3 effective up to AGI 40.",
"effect": "boostAgility",
"grade": 3,
"maxStatLimit": 40,
"quantity": 1,
"class": "potion",
"price": 480,
"sellprice": 192,
"tag": "Agility"
}>>
<<set $agilityboostpotion4 to {
"id": "agilityboostpotion4",
"name": "Void Stride Pill (Grade 4)",
"description": "Partially decouples the body from physical space during movement. Grade 4 effective up to AGI 60.",
"effect": "boostAgility",
"grade": 4,
"maxStatLimit": 60,
"quantity": 1,
"class": "potion",
"price": 950,
"sellprice": 380,
"tag": "Agility"
}>>
<<set $agilityboostpotion5 to {
"id": "agilityboostpotion5",
"name": "Void Stride Pill (Grade 5)",
"description": "The pinnacle of movement refinement. Recipients move as though skimming through dreams. Grade 5 effective up to AGI 80.",
"effect": "boostAgility",
"grade": 5,
"maxStatLimit": 80,
"quantity": 1,
"class": "potion",
"price": 2200,
"sellprice": 880,
"tag": "Agility"
}>>
/* ═══════════════════════════════════════════
WILLPOWER POTIONS — Grades 1–5
═══════════════════════════════════════════ */
<<set $willpowerboostpotion1 to {
"id": "willpowerboostpotion1",
"name": "Iron Will Pill (Grade 1)",
"description": "Tempers the mind and steadies the spirit. Grade 1 effective up to WIL 15.",
"effect": "boostWillpower",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 145,
"sellprice": 58,
"tag": "Willpower"
}>>
<<set $willpowerboostpotion2 to {
"id": "willpowerboostpotion2",
"name": "Iron Will Pill (Grade 2)",
"description": "Reinforces mental barriers and deepens meditative focus. Grade 2 effective up to WIL 25.",
"effect": "boostWillpower",
"grade": 2,
"maxStatLimit": 25,
"quantity": 1,
"class": "potion",
"price": 275,
"sellprice": 110,
"tag": "Willpower"
}>>
<<set $willpowerboostpotion3 to {
"id": "willpowerboostpotion3",
"name": "Diamond Mind Pill (Grade 3)",
"description": "Crystallizes the cultivator's resolve into an unshakeable pillar. Grade 3 effective up to WIL 40.",
"effect": "boostWillpower",
"grade": 3,
"maxStatLimit": 40,
"quantity": 1,
"class": "potion",
"price": 500,
"sellprice": 200,
"tag": "Willpower"
}>>
<<set $willpowerboostpotion4 to {
"id": "willpowerboostpotion4",
"name": "Diamond Mind Pill (Grade 4)",
"description": "The mind becomes a fortress. Heart demons cannot gain purchase. Grade 4 effective up to WIL 60.",
"effect": "boostWillpower",
"grade": 4,
"maxStatLimit": 60,
"quantity": 1,
"class": "potion",
"price": 960,
"sellprice": 384,
"tag": "Willpower"
}>>
<<set $willpowerboostpotion5 to {
"id": "willpowerboostpotion5",
"name": "Heaven's Resolve Pill (Grade 5)",
"description": "A legendary pill said to grant the unwavering will of an immortal. Grade 5 effective up to WIL 80.",
"effect": "boostWillpower",
"grade": 5,
"maxStatLimit": 80,
"quantity": 1,
"class": "potion",
"price": 2100,
"sellprice": 840,
"tag": "Willpower"
}>>
/* ═══════════════════════════════════════════
CHARISMA POTIONS — Grades 1–4
(existing Grade 1: succubusbreath uses boostCharisma)
═══════════════════════════════════════════ */
<<set $charismaboostpotion2 to {
"id": "charismaboostpotion2",
"name": "Jade Aura Pill (Grade 2)",
"description": "Refines manner and bearing. Others instinctively trust and admire you. Grade 2 effective up to CHA 25.",
"effect": "boostCharisma",
"grade": 2,
"maxStatLimit": 25,
"quantity": 1,
"class": "potion",
"price": 280,
"sellprice": 112,
"tag": "Charisma"
}>>
<<set $charismaboostpotion3 to {
"id": "charismaboostpotion3",
"name": "Phoenix Grace Pill (Grade 3)",
"description": "Grants an imperious radiance that commands respect across social boundaries. Grade 3 effective up to CHA 40.",
"effect": "boostCharisma",
"grade": 3,
"maxStatLimit": 40,
"quantity": 1,
"class": "potion",
"price": 520,
"sellprice": 208,
"tag": "Charisma"
}>>
<<set $charismaboostpotion4 to {
"id": "charismaboostpotion4",
"name": "Sovereign Presence Pill (Grade 4)",
"description": "A pill reserved for those walking the path of kings. Your very presence silences rooms. Grade 4 effective up to CHA 60.",
"effect": "boostCharisma",
"grade": 4,
"maxStatLimit": 60,
"quantity": 1,
"class": "potion",
"price": 1000,
"sellprice": 400,
"tag": "Charisma"
}>>
/* ═══════════════════════════════════════════
LUCK POTIONS — Grades 1–3
═══════════════════════════════════════════ */
<<set $luckboostpotion1 to {
"id": "luckboostpotion1",
"name": "Fortune Mist Pill (Grade 1)",
"description": "Slightly shifts fate in your favor. Small blessings accumulate. Grade 1 effective up to LCK 15.",
"effect": "boostLuck",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 200,
"sellprice": 80,
"tag": "Luck"
}>>
<<set $luckboostpotion2 to {
"id": "luckboostpotion2",
"name": "Fortune Mist Pill (Grade 2)",
"description": "Fate threads itself around the user. Coincidences become meaningful. Grade 2 effective up to LCK 25.",
"effect": "boostLuck",
"grade": 2,
"maxStatLimit": 25,
"quantity": 1,
"class": "potion",
"price": 450,
"sellprice": 180,
"tag": "Luck"
}>>
<<set $luckboostpotion3 to {
"id": "luckboostpotion3",
"name": "Heaven's Chosen Pill (Grade 3)",
"description": "Heaven itself seems to smile. Enemies stumble, treasures appear, and escape routes open. Grade 3 effective up to LCK 40.",
"effect": "boostLuck",
"grade": 3,
"maxStatLimit": 40,
"quantity": 1,
"class": "potion",
"price": 850,
"sellprice": 340,
"tag": "Luck"
}>>
/* ═══════════════════════════════════════════
INSIGHT POTIONS — Grades 1–3
═══════════════════════════════════════════ */
<<set $insightboostpotion1 to {
"id": "insightboostpotion1",
"name": "Clear Eye Pill (Grade 1)",
"description": "Sharpens perception and broadens spatial awareness. Grade 1 effective up to INS 15.",
"effect": "boostInsight",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 190,
"sellprice": 76,
"tag": "Insight"
}>>
<<set $insightboostpotion2 to {
"id": "insightboostpotion2",
"name": "Clear Eye Pill (Grade 2)",
"description": "Expands the cultivator's sense of the battlefield. Reading intent becomes instinctive. Grade 2 effective up to INS 25.",
"effect": "boostInsight",
"grade": 2,
"maxStatLimit": 25,
"quantity": 1,
"class": "potion",
"price": 420,
"sellprice": 168,
"tag": "Insight"
}>>
<<set $insightboostpotion3 to {
"id": "insightboostpotion3",
"name": "Heaven-Sight Pill (Grade 3)",
"description": "Sight and mind fuse into something beyond normal perception. Grade 3 effective up to INS 40.",
"effect": "boostInsight",
"grade": 3,
"maxStatLimit": 40,
"quantity": 1,
"class": "potion",
"price": 800,
"sellprice": 320,
"tag": "Insight"
}>>
/* ═══════════════════════════════════════════
MAX HEALTH POTIONS — Grades 1–4
═══════════════════════════════════════════ */
<<set $maxhealthpotion1 to {
"id": "maxhealthpotion1",
"name": "Life Sea Pill (Grade 1)",
"description": "Expands the body's life force reserves. Grade 1 effective up to MaxHP 400.",
"effect": "boostMaxHealth",
"grade": 1,
"maxStatLimit": 400,
"quantity": 1,
"class": "potion",
"price": 160,
"sellprice": 64,
"tag": "Health"
}>>
<<set $maxhealthpotion2 to {
"id": "maxhealthpotion2",
"name": "Life Sea Pill (Grade 2)",
"description": "Deepens the life sea through blood and marrow refinement. Grade 2 effective up to MaxHP 600.",
"effect": "boostMaxHealth",
"grade": 2,
"maxStatLimit": 600,
"quantity": 1,
"class": "potion",
"price": 330,
"sellprice": 132,
"tag": "Health"
}>>
<<set $maxhealthpotion3 to {
"id": "maxhealthpotion3",
"name": "Undying Foundation Pill (Grade 3)",
"description": "Restructures the foundation of life itself. Grade 3 effective up to MaxHP 900.",
"effect": "boostMaxHealth",
"grade": 3,
"maxStatLimit": 900,
"quantity": 1,
"class": "potion",
"price": 650,
"sellprice": 260,
"tag": "Health"
}>>
<<set $maxhealthpotion4 to {
"id": "maxhealthpotion4",
"name": "Undying Foundation Pill (Grade 4)",
"description": "The body becomes a vessel capable of holding a near-divine amount of life energy. Grade 4 effective up to MaxHP 1400.",
"effect": "boostMaxHealth",
"grade": 4,
"maxStatLimit": 1400,
"quantity": 1,
"class": "potion",
"price": 1400,
"sellprice": 560,
"tag": "Health"
}>>
/* ═══════════════════════════════════════════
MAX ENERGY POTIONS — Grades 1–4
═══════════════════════════════════════════ */
<<set $maxenergypotion1 to {
"id": "maxenergypotion1",
"name": "Qi Sea Pill (Grade 1)",
"description": "Widens the cultivator's energy meridians, allowing more qi to circulate. Grade 1 effective up to MaxEnergy 300.",
"effect": "boostMaxEnergy",
"grade": 1,
"maxStatLimit": 300,
"quantity": 1,
"class": "potion",
"price": 155,
"sellprice": 62,
"tag": "Energy"
}>>
<<set $maxenergypotion2 to {
"id": "maxenergypotion2",
"name": "Qi Sea Pill (Grade 2)",
"description": "Opens secondary meridian pathways, greatly increasing energy capacity. Grade 2 effective up to MaxEnergy 500.",
"effect": "boostMaxEnergy",
"grade": 2,
"maxStatLimit": 500,
"quantity": 1,
"class": "potion",
"price": 320,
"sellprice": 128,
"tag": "Energy"
}>>
<<set $maxenergypotion3 to {
"id": "maxenergypotion3",
"name": "Boundless Sea Pill (Grade 3)",
"description": "Cultivator's energy sea expands to rival that of a core-stage elder. Grade 3 effective up to MaxEnergy 800.",
"effect": "boostMaxEnergy",
"grade": 3,
"maxStatLimit": 800,
"quantity": 1,
"class": "potion",
"price": 600,
"sellprice": 240,
"tag": "Energy"
}>>
<<set $maxenergypotion4 to {
"id": "maxenergypotion4",
"name": "Boundless Sea Pill (Grade 4)",
"description": "The energy sea becomes an ocean without horizon. Grade 4 effective up to MaxEnergy 1200.",
"effect": "boostMaxEnergy",
"grade": 4,
"maxStatLimit": 1200,
"quantity": 1,
"class": "potion",
"price": 1350,
"sellprice": 540,
"tag": "Energy"
}>>
/* ═══════════════════════════════════════════
LIFESPAN POTIONS — Grades 1–3
═══════════════════════════════════════════ */
<<set $lifespanpotion1 to {
"id": "lifespanpotion1",
"name": "Longevity Root Pill (Grade 1)",
"description": "Slows cellular decay at the qi level. Adds modest years to maximum lifespan.",
"effect": "boostLifespan",
"grade": 1,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 350,
"sellprice": 140,
"tag": "Lifespan"
}>>
<<set $lifespanpotion2 to {
"id": "lifespanpotion2",
"name": "Immortal Breath Pill (Grade 2)",
"description": "Refines the body's time-essence, granting a meaningful extension to one's natural span.",
"effect": "boostLifespan",
"grade": 2,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 700,
"sellprice": 280,
"tag": "Lifespan"
}>>
<<set $lifespanpotion3 to {
"id": "lifespanpotion3",
"name": "Heaven Longevity Pill (Grade 3)",
"description": "Said to add centuries when taken by a high-realm cultivator. The pinnacle of life-extending alchemy.",
"effect": "boostLifespan",
"grade": 3,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 1800,
"sellprice": 720,
"tag": "Lifespan"
}>>
/* ═══════════════════════════════════════════
SPIRITUAL ROOT POTIONS — Grades 1–4
═══════════════════════════════════════════ */
<<set $spiritootpotion1 to {
"id": "spiritootpotion1",
"name": "Root Nourishing Pill (Grade 1)",
"description": "Nourishes the spiritual root to improve natural qi absorption rate. Grade 1 effective up to SR 15.",
"effect": "boostSpiritualRoot",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 200,
"sellprice": 80,
"tag": "SpiritualRoot"
}>>
<<set $spiritrootpotion2 to {
"id": "spiritrootpotion2",
"name": "Root Nourishing Pill (Grade 2)",
"description": "Deepens the spiritual root's connection to heaven and earth. Grade 2 effective up to SR 30.",
"effect": "boostSpiritualRoot",
"grade": 2,
"maxStatLimit": 30,
"quantity": 1,
"class": "potion",
"price": 420,
"sellprice": 168,
"tag": "SpiritualRoot"
}>>
<<set $spiritrootpotion3 to {
"id": "spiritrootpotion3",
"name": "Heaven Root Awakening Pill (Grade 3)",
"description": "Purges blockages in the spiritual root, allowing hidden talent to emerge. Grade 3 effective up to SR 50.",
"effect": "boostSpiritualRoot",
"grade": 3,
"maxStatLimit": 50,
"quantity": 1,
"class": "potion",
"price": 850,
"sellprice": 340,
"tag": "SpiritualRoot"
}>>
<<set $spiritrootpotion4 to {
"id": "spiritrootpotion4",
"name": "True Heaven Root Pill (Grade 4)",
"description": "Restructures the user's innate talent at its source. Coveted by entire sects. Grade 4 effective up to SR 70.",
"effect": "boostSpiritualRoot",
"grade": 4,
"maxStatLimit": 70,
"quantity": 1,
"class": "potion",
"price": 2000,
"sellprice": 800,
"tag": "SpiritualRoot"
}>>
/* ═══════════════════════════════════════════
MARTIAL ARTS POTIONS — Grades 1–3
═══════════════════════════════════════════ */
<<set $martialartspotionpotion1 to {
"id": "martialartspotionpotion1",
"name": "Battle Sense Pill (Grade 1)",
"description": "Refines combat instincts and improves technique retention. Grade 1 effective up to MA 20.",
"effect": "boostMartialArts",
"grade": 1,
"maxStatLimit": 20,
"quantity": 1,
"class": "potion",
"price": 180,
"sellprice": 72,
"tag": "MartialArts"
}>>
<<set $martialartspotionpotion2 to {
"id": "martialartspotionpotion2",
"name": "Battle Sense Pill (Grade 2)",
"description": "Sharpens combat flow, allowing techniques to chain naturally during battle. Grade 2 effective up to MA 35.",
"effect": "boostMartialArts",
"grade": 2,
"maxStatLimit": 35,
"quantity": 1,
"class": "potion",
"price": 400,
"sellprice": 160,
"tag": "MartialArts"
}>>
<<set $martialartspotionpotion3 to {
"id": "martialartspotionpotion3",
"name": "Unrivalled Form Pill (Grade 3)",
"description": "Engraves perfect martial memory into the body. Mistakes become impossible during peak performance. Grade 3 effective up to MA 55.",
"effect": "boostMartialArts",
"grade": 3,
"maxStatLimit": 55,
"quantity": 1,
"class": "potion",
"price": 900,
"sellprice": 360,
"tag": "MartialArts"
}>>
/* ═══════════════════════════════════════════
CORRUPTION POTIONS — Grades 1–5
(Grade 2: corruptionelixir and Grade 3: forbiddenyangseed already exist)
═══════════════════════════════════════════ */
<<set $corruptionelixir1 to {
"id": "corruptionelixir1",
"name": "Tainted Dew Drop",
"description": "A faint mist of demonic qi condensed into liquid. The first step down a dangerous road. Slightly raises corruption.",
"effect": "raiseCorruption",
"grade": 1,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 120,
"sellprice": 30,
"tag": "Corruption"
}>>
/* Grade 2 is $corruptionelixir (Heart Demon Nectar) */
/* Grade 3 is $forbiddenyangseed (Forbidden Yang Seed) */
<<set $corruptionelixir4 to {
"id": "corruptionelixir4",
"name": "Abyss Communion Draft",
"description": "Binds a fragment of demonic will to the cultivator's spirit. A point of no return for many. Greatly raises corruption.",
"effect": "deepCorruption",
"grade": 4,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 800,
"sellprice": 200,
"tag": "Corruption"
}>>
<<set $corruptionelixir5 to {
"id": "corruptionelixir5",
"name": "Void Demon Ascension Elixir",
"description": "The pinnacle of dark alchemy. Permanently fuses demonic essence into the cultivator's core. Catastrophically raises corruption.",
"effect": "deepCorruption",
"grade": 5,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 1500,
"sellprice": 375,
"tag": "Corruption"
}>>
/* ═══════════════════════════════════════════
DEFENSE / ARMOR POTIONS — Grades 1–3
═══════════════════════════════════════════ */
<<set $armorboostpotion1 to {
"id": "armorboostpotion1",
"name": "Iron Skin Pill (Grade 1)",
"description": "Hardens the outer body, reducing the impact of strikes. Grade 1 effective up to ARM 10.",
"effect": "boostArmor",
"grade": 1,
"maxStatLimit": 10,
"quantity": 1,
"class": "potion",
"price": 130,
"sellprice": 52,
"tag": "Armor"
}>>
<<set $armorboostpotion2 to {
"id": "armorboostpotion2",
"name": "Iron Skin Pill (Grade 2)",
"description": "Layers the skin with qi-infused mineral essence. Grade 2 effective up to ARM 20.",
"effect": "boostArmor",
"grade": 2,
"maxStatLimit": 20,
"quantity": 1,
"class": "potion",
"price": 300,
"sellprice": 120,
"tag": "Armor"
}>>
<<set $armorboostpotion3 to {
"id": "armorboostpotion3",
"name": "Stone Shell Pill (Grade 3)",
"description": "The cultivator's outer body approaches the hardness of a spirit beast's natural armor. Grade 3 effective up to ARM 35.",
"effect": "boostArmor",
"grade": 3,
"maxStatLimit": 35,
"quantity": 1,
"class": "potion",
"price": 600,
"sellprice": 240,
"tag": "Armor"
}>><<BackgroundHandler>>
You carefully kneel and begin collecting the herbs, taking care not to damage their roots.
Their scent is invigorating, and you can already imagine the pills or elixirs they might produce.
<<gainRandomItem>>
You've found <<print _item.name>>!
<<return "Go back">><<set $temperedbonefragment to {"name": "Tempered Bone Fragment", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 40, "tripleprice": 120, "sellprice": 12, "class": "item", "quantity": 0, "description": "Beast bone used to toughen the body.", "id": "temperedbonefragment"}>>
<<set $bodyforgingelixir to {"name": "Body Forging Elixir", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 50, "tripleprice": 150, "sellprice": 15, "class": "item", "quantity": 0, "description": "Strengthens muscles during training.", "id": "bodyforgingelixir"}>>
<<set $copperskinpowder to {"name": "Copper Skin Powder", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 45, "tripleprice": 135, "sellprice": 13, "class": "item", "quantity": 0, "description": "Boosts external durability for beginners.", "id": "copperskinpowder"}>>
<<set $bloodhardeningherb to {"name": "Blood Hardening Herb", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 55, "tripleprice": 165, "sellprice": 16, "class": "item", "quantity": 0, "description": "Thickens blood, reinforcing organs.", "id": "bloodhardeningherb"}>>
<<set $sturdygrassfiber to {"name": "Sturdy Grass Fiber", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 35, "tripleprice": 105, "sellprice": 10, "class": "item", "quantity": 0, "description": "Used in martial body rituals.", "id": "sturdygrassfiber"}>>
<<set $ironbloodlotusseed to {"name": "Ironblood Lotus Seed", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 90, "tripleprice": 270, "sellprice": 27, "class": "item", "quantity": 0, "description": "A seed that fortifies bone and blood.", "id": "ironbloodlotusseed"}>>
<<set $mountainoxtendon to {"name": "Mountain Ox Tendon", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 100, "tripleprice": 300, "sellprice": 30, "class": "item", "quantity": 0, "description": "Contains essence to improve muscle density.", "id": "mountainoxtendon"}>>
<<set $crimsonhideflake to {"name": "Crimson Hide Flake", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 85, "tripleprice": 255, "sellprice": 25, "class": "item", "quantity": 0, "description": "From beasts known for tough hides.", "id": "crimsonhideflake"}>>
<<set $vitalityroot to {"name": "Vitality Root", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 95, "tripleprice": 285, "sellprice": 28, "class": "item", "quantity": 0, "description": "Improves endurance and physical resilience.", "id": "vitalityroot"}>>
<<set $burningsandresin to {"name": "Burning Sand Resin", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 80, "tripleprice": 240, "sellprice": 24, "class": "item", "quantity": 0, "description": "Mixed into pills for body forging.", "id": "burningsandresin"}>>
<<set $dragonbonedust to {"name": "Dragonbone Dust", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 45, "class": "item", "quantity": 0, "description": "Legendary dust said to make skin unbreakable.", "id": "dragonbonedust"}>>
<<set $moltengolddew to {"name": "Molten Gold Dew", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 400, "tripleprice": 1200, "sellprice": 360, "class": "item", "quantity": 0, "description": "Rare liquid said to rebuild the body.", "id": "moltengolddew"}>>
<<set $titanapehair to {"name": "Titan Ape Hair", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 155, "tripleprice": 465, "sellprice": 46, "class": "item", "quantity": 0, "description": "Imbues user with great physical strength.", "id": "titanapehair"}>>
<<set $heavenlyemberflower to {"name": "Heavenly Ember Flower", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 165, "tripleprice": 495, "sellprice": 49, "class": "item", "quantity": 0, "description": "Used in heavenly-grade body pills.", "id": "heavenlyemberflower"}>>
<<set $phoenixbloodflake to {"name": "Phoenix Blood Flake", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 170, "tripleprice": 510, "sellprice": 51, "class": "item", "quantity": 0, "description": "Reshapes mortal frame to near-divine.", "id": "phoenixbloodflake"}>>
<<set $spiritvinetendril to {"name": "Spirit Vine Tendril", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 45, "tripleprice": 135, "sellprice": 13, "class": "item", "quantity": 0, "description": "Mildly stimulates meridian activity.", "id": "spiritvinetendril"}>>
<<set $qispunsilk to {"name": "Qi-Spun Silk", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 40, "tripleprice": 120, "sellprice": 12, "class": "item", "quantity": 0, "description": "Enhances energy circulation slightly.", "id": "qispunsilk"}>>
<<set $stonepulsepebble to {"name": "Stone Pulse Pebble", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 50, "tripleprice": 150, "sellprice": 15, "class": "item", "quantity": 0, "description": "Used in meditative formations.", "id": "stonepulsepebble"}>>
<<set $clearwaterextract to {"name": "Clearwater Extract", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 55, "tripleprice": 165, "sellprice": 16, "class": "item", "quantity": 0, "description": "Flushes impurities from meridians.", "id": "clearwaterextract"}>>
<<set $lessermeridiandust to {"name": "Lesser Meridian Dust", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 35, "tripleprice": 105, "sellprice": 10, "class": "item", "quantity": 0, "description": "Base material for opening pill recipes.", "id": "lessermeridiandust"}>>
<<set $brightmeridiancrystal to {"name": "Bright Meridian Crystal", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 95, "tripleprice": 285, "sellprice": 28, "class": "item", "quantity": 0, "description": "Directly enhances inner flow.", "id": "brightmeridiancrystal"}>>
<<set $serpentpulsesalve to {"name": "Serpent Pulse Salve", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 90, "tripleprice": 270, "sellprice": 27, "class": "item", "quantity": 0, "description": "Used to ease meridian blockages.", "id": "serpentpulsesalve"}>>
<<set $thunderweed to {"name": "Thunderweed", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 85, "tripleprice": 255, "sellprice": 25, "class": "item", "quantity": 0, "description": "Stimulates qi flow violently.", "id": "thunderweed"}>>
<<set $moonlightshell to {"name": "Moonlight Shell", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 100, "tripleprice": 300, "sellprice": 30, "class": "item", "quantity": 0, "description": "Cools and soothes energy pathways.", "id": "moonlightshell"}>>
<<set $nineleaflotus to {"name": "Nineleaf Lotus", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 105, "tripleprice": 315, "sellprice": 31, "class": "item", "quantity": 0, "description": "Refines and strengthens core meridians.", "id": "nineleaflotus"}>>
<<set $divinepulsestone to {"name": "Divine Pulse Stone", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 160, "tripleprice": 480, "sellprice": 48, "class": "item", "quantity": 0, "description": "Used by ancient sects for breakthroughs.", "id": "divinepulsestone"}>>
<<set $astraldewdrop to {"name": "Astral Dewdrop", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 170, "tripleprice": 510, "sellprice": 51, "class": "item", "quantity": 0, "description": "Mythical water for meridian clarity.", "id": "astraldewdrop"}>>
<<set $qidragonpearl to {"name": "Qi Dragon Pearl", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 175, "tripleprice": 525, "sellprice": 52, "class": "item", "quantity": 0, "description": "Enhances all internal channels.", "id": "qidragonpearl"}>>
<<set $voidmeridiancore to {"name": "Void Meridian Core", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 165, "tripleprice": 495, "sellprice": 49, "class": "item", "quantity": 0, "description": "Said to awaken even dormant talents.", "id": "voidmeridiancore"}>>
<<set $sunheartbark to {"name": "Sunheart Bark", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 155, "tripleprice": 465, "sellprice": 46, "class": "item", "quantity": 0, "description": "Generates warmth that spreads through body.", "id": "sunheartbark"}>>
<<set $faintqicrystal to {"name": "Faint Qi Crystal", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 50, "tripleprice": 150, "sellprice": 15, "class": "item", "quantity": 0, "description": "Can be absorbed by beginners.", "id": "faintqicrystal"}>>
<<set $meditationdust to {"name": "Meditation Dust", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 45, "tripleprice": 135, "sellprice": 13, "class": "item", "quantity": 0, "description": "Improves focus during breakthrough.", "id": "meditationdust"}>>
<<set $refinedspiritwater to {"name": "Refined Spirit Water", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 55, "tripleprice": 165, "sellprice": 16, "class": "item", "quantity": 0, "description": "Helps stabilize internal energy.", "id": "refinedspiritwater"}>>
<<set $crackedflowcharm to {"name": "Cracked Flow Charm", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 40, "tripleprice": 120, "sellprice": 12, "class": "item", "quantity": 0, "description": "Still carries usable qi patterns.", "id": "crackedflowcharm"}>>
<<set $risingmistherb to {"name": "Rising Mist Herb", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 35, "tripleprice": 105, "sellprice": 10, "class": "item", "quantity": 0, "description": "Mildly enhances energy cohesion.", "id": "risingmistherb"}>>
<<set $condensedqistone to {"name": "Condensed Qi Stone", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 95, "tripleprice": 285, "sellprice": 28, "class": "item", "quantity": 0, "description": "Holds stable, purified energy.", "id": "condensedqistone"}>>
<<set $jadegatheringthread to {"name": "Jade Gathering Thread", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 100, "tripleprice": 300, "sellprice": 30, "class": "item", "quantity": 0, "description": "Conducts energy smoothly during training.", "id": "jadegatheringthread"}>>
<<set $flowrootessence to {"name": "Flowroot Essence", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 90, "tripleprice": 270, "sellprice": 27, "class": "item", "quantity": 0, "description": "Draws external energy inward.", "id": "flowrootessence"}>>
<<set $innerflamecore to {"name": "Inner Flame Core", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 85, "tripleprice": 255, "sellprice": 25, "class": "item", "quantity": 0, "description": "Improves inner condensation quality.", "id": "innerflamecore"}>>
<<set $windveinpowder to {"name": "Wind Vein Powder", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 105, "tripleprice": 315, "sellprice": 31, "class": "item", "quantity": 0, "description": "Boosts spiraling qi motion.", "id": "windveinpowder"}>>
<<set $voidstormtear to {"name": "Voidstorm Tear", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 180, "tripleprice": 540, "sellprice": 54, "class": "item", "quantity": 0, "description": "Used to condense divine-quality qi.", "id": "voidstormtear"}>>
<<set $celestialcorecrystal to {"name": "Celestial Core Crystal", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 190, "tripleprice": 570, "sellprice": 57, "class": "item", "quantity": 0, "description": "Pulsates with raw elemental energy.", "id": "celestialcorecrystal"}>>
<<set $heavendrawingink to {"name": "Heaven-Drawing Ink", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 170, "tripleprice": 510, "sellprice": 51, "class": "item", "quantity": 0, "description": "Used in inscriptions to reshape qi.", "id": "heavendrawingink"}>>
<<set $originqiflake to {"name": "Origin Qi Flake", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 175, "tripleprice": 525, "sellprice": 52, "class": "item", "quantity": 0, "description": "Contains untouched universal energy.", "id": "originqiflake"}>>
<<set $truemistheart to {"name": "True Mist Heart", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 185, "tripleprice": 555, "sellprice": 55, "class": "item", "quantity": 0, "description": "Condenses all surrounding energies into user.", "id": "truemistheart"}>>
<<set $riverpearlscale to {
"name": "River Pearl Scale",
"strength": 0,
"agility": 0,
"willpower": 2,
"armor": 5,
"health": 0,
"energy": 0,
"evadescore": 0,
"price": 120,
"tripleprice": 360,
"sellprice": 36,
"class": "item",
"quantity": 0,
"description": "A shimmering, iridescent scale that provides a calming aura of the tides.",
"id": "riverpearlscale"
}>>
<<set $serpentmarkscale to {
"name": "Serpent Mark Scale",
"strength": 0,
"agility": 3,
"willpower": 0,
"armor": 3,
"health": 0,
"energy": 0,
"evadescore": 5,
"price": 150,
"tripleprice": 450,
"sellprice": 45,
"class": "item",
"quantity": 0,
"description": "A dark scale engraved with natural markings; it feels strangely light and flexible.",
"id": "serpentmarkscale"
}>>
/* ─── BODY FORGING ITEMS (existing category additions) ─── */
<<set $beastsinewfiber to {
"name": "Beast Sinew Fiber",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 60, "tripleprice": 180, "sellprice": 18,
"class": "item", "quantity": 0,
"description": "Tough sinew from a spirit beast. Used in strength-forging recipes.",
"id": "beastsinewfiber"
}>>
<<set $ironcorehusk to {
"name": "Iron Core Husk",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 70, "tripleprice": 210, "sellprice": 21,
"class": "item", "quantity": 0,
"description": "Dense outer shell of an iron-type spirit fruit.",
"id": "ironcorehusk"
}>>
<<set $goldenmarrowfragment to {
"name": "Golden Marrow Fragment",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 200, "tripleprice": 600, "sellprice": 60,
"class": "item", "quantity": 0,
"description": "Rare marrow fragment suffused with golden qi. Fortifies bones at the foundation level.",
"id": "goldenmarrowfragment"
}>>
<<set $thunderlizardhide to {
"name": "Thunder Lizard Hide",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 130, "tripleprice": 390, "sellprice": 39,
"class": "item", "quantity": 0,
"description": "Hardened hide that conducts faint lightning. Used in defense-enhancing concoctions.",
"id": "thunderlizardhide"
}>>
<<set $solarstonepowder to {
"name": "Solar Stone Powder",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 110, "tripleprice": 330, "sellprice": 33,
"class": "item", "quantity": 0,
"description": "Ground from sun-hardened ore. Amplifies yang-aligned body techniques.",
"id": "solarstonepowder"
}>>
/* ─── AGILITY / MOVEMENT ITEMS ─── */
<<set $swiftwindfeather to {
"name": "Swiftwind Feather",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 55, "tripleprice": 165, "sellprice": 16,
"class": "item", "quantity": 0,
"description": "A feather from a wind-aspected spirit bird. Lightens the body.",
"id": "swiftwindfeather"
}>>
<<set $shadowstepmoss to {
"name": "Shadow Step Moss",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 65, "tripleprice": 195, "sellprice": 19,
"class": "item", "quantity": 0,
"description": "Grows only in lightless caves. Muffles footsteps and improves spatial awareness.",
"id": "shadowstepmoss"
}>>
<<set $cloudstepextract to {
"name": "Cloud Step Extract",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 90, "tripleprice": 270, "sellprice": 27,
"class": "item", "quantity": 0,
"description": "Distilled from high-altitude cloud moss. Reduces a cultivator's weight signature.",
"id": "cloudstepextract"
}>>
<<set $lightningsteptendon to {
"name": "Lightning Step Tendon",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 140, "tripleprice": 420, "sellprice": 42,
"class": "item", "quantity": 0,
"description": "From a beast struck by heavenly lightning. Transmits speed impulses instantly.",
"id": "lightningsteptendon"
}>>
<<set $voidstrideessence to {
"name": "Void Stride Essence",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 220, "tripleprice": 660, "sellprice": 66,
"class": "item", "quantity": 0,
"description": "Condenses spatial qi into liquid form. Grants brief flashes of displacement.",
"id": "voidstrideessence"
}>>
/* ─── MIND / WILLPOWER ITEMS ─── */
<<set $cinnabarheartstone to {
"name": "Cinnabar Heart Stone",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 75, "tripleprice": 225, "sellprice": 22,
"class": "item", "quantity": 0,
"description": "A red stone that vibrates in resonance with mental intent.",
"id": "cinnabarheartstone"
}>>
<<set $stillwaterpearlpowder to {
"name": "Stillwater Pearl Powder",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 85, "tripleprice": 255, "sellprice": 25,
"class": "item", "quantity": 0,
"description": "Ground from river pearls. Calms turbulent inner qi and strengthens resolve.",
"id": "stillwaterpearlpowder"
}>>
<<set $moonlitjadefragment to {
"name": "Moonlit Jade Fragment",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 145, "tripleprice": 435, "sellprice": 43,
"class": "item", "quantity": 0,
"description": "Jade soaked in moonlight for three full cycles. Purifies heart demons.",
"id": "moonlitjadeFragment"
}>>
<<set $emptymindherb to {
"name": "Empty Mind Herb",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 60, "tripleprice": 180, "sellprice": 18,
"class": "item", "quantity": 0,
"description": "A bitter herb that clears mental fog and improves focus during cultivation.",
"id": "emptymindherb"
}>>
<<set $soulmirrorcrystal to {
"name": "Soul Mirror Crystal",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 190, "tripleprice": 570, "sellprice": 57,
"class": "item", "quantity": 0,
"description": "A transparent crystal that reflects one's inner state. Used in advanced willpower refinement.",
"id": "soulmirrorcrystal"
}>>
/* ─── CHARISMA / SOCIAL ITEMS ─── */
<<set $rosedewhoney to {
"name": "Rose Dew Honey",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 50, "tripleprice": 150, "sellprice": 15,
"class": "item", "quantity": 0,
"description": "Honey from spirit bees. Sweetens the voice and softens the demeanor.",
"id": "rosedewhoney"
}>>
<<set $jadepetalpowder to {
"name": "Jade Petal Powder",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 70, "tripleprice": 210, "sellprice": 21,
"class": "item", "quantity": 0,
"description": "Ground from rare jade lotus petals. Improves complexion and social grace.",
"id": "jadepetalpowder"
}>>
<<set $phoenixcoilperfume to {
"name": "Phoenix Coil Perfume",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 160, "tripleprice": 480, "sellprice": 48,
"class": "item", "quantity": 0,
"description": "Distilled from phoenix tail feathers. Commands attention and inspires reverence.",
"id": "phoenixcoilperfume"
}>>
<<set $silvertongueroot to {
"name": "Silvertongue Root",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 80, "tripleprice": 240, "sellprice": 24,
"class": "item", "quantity": 0,
"description": "Chewed by diplomats before negotiations. Subtly aligns a speaker's words to the listener's desires.",
"id": "silvertongueroot"
}>>
/* ─── LUCK / INSIGHT ITEMS ─── */
<<set $fortunemistseed to {
"name": "Fortune Mist Seed",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 95, "tripleprice": 285, "sellprice": 28,
"class": "item", "quantity": 0,
"description": "Said to grow only where heaven's fortune pools.",
"id": "fortunemistseed"
}>>
<<set $prophetseyeflower to {
"name": "Prophet's Eye Flower",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 130, "tripleprice": 390, "sellprice": 39,
"class": "item", "quantity": 0,
"description": "A rare bloom that briefly heightens perception and insight.",
"id": "prophetseyeflower"
}>>
<<set $destinythreadfragment to {
"name": "Destiny Thread Fragment",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 250, "tripleprice": 750, "sellprice": 75,
"class": "item", "quantity": 0,
"description": "A fragment of someone's severed fate. Absorbing it slightly bends fortune in your favor.",
"id": "destinythreadfragment"
}>>
/* ─── HEALTH / VITALITY ITEMS ─── */
<<set $greenspiritsap to {
"name": "Green Spirit Sap",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 60, "tripleprice": 180, "sellprice": 18,
"class": "item", "quantity": 0,
"description": "Sap from a thousand-year wood spirit tree. Regenerates minor wounds.",
"id": "greenspiritsap"
}>>
<<set $bloodlotuspetal to {
"name": "Blood Lotus Petal",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 110, "tripleprice": 330, "sellprice": 33,
"class": "item", "quantity": 0,
"description": "Deep red petals that stimulate blood production and repair internal injuries.",
"id": "bloodlotuspetal"
}>>
<<set $heavenspringwater to {
"name": "Heaven Spring Water",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 200, "tripleprice": 600, "sellprice": 60,
"class": "item", "quantity": 0,
"description": "Water from a heavenly spring. Cleanses impurities and greatly strengthens the body's foundation.",
"id": "heavenspringwater"
}>>
<<set $undyingphoenixash to {
"name": "Undying Phoenix Ash",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 350, "tripleprice": 1050, "sellprice": 105,
"class": "item", "quantity": 0,
"description": "Ash from a phoenix rebirth. Said to repair even fatal wounds over time.",
"id": "undyingphoenixash"
}>>
/* ─── ENERGY / QI RECOVERY ITEMS ─── */
<<set $breathingmoonmoss to {
"name": "Breathing Moon Moss",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 55, "tripleprice": 165, "sellprice": 16,
"class": "item", "quantity": 0,
"description": "Absorbs lunar qi at night. Brewed into pills for energy restoration.",
"id": "breathingmoonmoss"
}>>
<<set $tidewaterpearl to {
"name": "Tidewater Pearl",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 120, "tripleprice": 360, "sellprice": 36,
"class": "item", "quantity": 0,
"description": "A spirit pearl formed at the ocean's deepest tides. Stores tremendous latent qi.",
"id": "tidewaterpearl"
}>>
<<set $primordialmistdrop to {
"name": "Primordial Mist Drop",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 300, "tripleprice": 900, "sellprice": 90,
"class": "item", "quantity": 0,
"description": "A single drop condensed from primordial chaos. Vastly expands the energy sea.",
"id": "primordialmistdrop"
}>>
/* ─── LIFESPAN ITEMS ─── */
<<set $agelesspinetwig to {
"name": "Ageless Pine Twig",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 180, "tripleprice": 540, "sellprice": 54,
"class": "item", "quantity": 0,
"description": "A twig from a ten-thousand-year pine. Slightly slows the aging process.",
"id": "agelesspinetwig"
}>>
<<set $eternalmoonresin to {
"name": "Eternal Moon Resin",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 280, "tripleprice": 840, "sellprice": 84,
"class": "item", "quantity": 0,
"description": "Resin secreted only during a full moon eclipse. Rumored to grant decades of extra life.",
"id": "eternalmoonresin"
}>>
<<set $heavenlongevityseed to {
"name": "Heaven Longevity Seed",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 500, "tripleprice": 1500, "sellprice": 150,
"class": "item", "quantity": 0,
"description": "A seed that blooms once every ten thousand years. The ultimate ingredient in lifespan-extending pills.",
"id": "heavenlongevityseed"
}>>
/* ─── DARK / DEMONIC ITEMS ─── */
<<set $demonbileextract to {
"name": "Demon Bile Extract",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 120, "tripleprice": 360, "sellprice": 36,
"class": "item", "quantity": 0,
"description": "Bile taken from a slain demon beast. Caustic to the righteous, nourishing to the wicked.",
"id": "demonbileextract"
}>>
<<set $heartdevilweed to {
"name": "Heart Devil Weed",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 90, "tripleprice": 270, "sellprice": 27,
"class": "item", "quantity": 0,
"description": "A violet weed that feeds on repressed desires. Brewed into corruption-inducing elixirs.",
"id": "heartdevilweed"
}>>
<<set $duskbloodmoss to {
"name": "Dusk Blood Moss",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 75, "tripleprice": 225, "sellprice": 22,
"class": "item", "quantity": 0,
"description": "Grows on cursed battlefields. Absorbs lingering resentment and killing intent.",
"id": "duskbloodmoss"
}>>
<<set $shadowlustpollen to {
"name": "Shadow Lust Pollen",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 150, "tripleprice": 450, "sellprice": 45,
"class": "item", "quantity": 0,
"description": "Pollen from a nocturnal spirit flower. Inflames hidden desires and weakens moral resistance.",
"id": "shadowlustpollen"
}>>
<<set $taboofleshseal to {
"name": "Taboo Flesh Seal",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 200, "tripleprice": 600, "sellprice": 60,
"class": "item", "quantity": 0,
"description": "A forbidden seal carved into demon flesh. Carrying it invites corruption.",
"id": "taboofleshseal"
}>>
<<set $abyssalheartcore to {
"name": "Abyssal Heart Core",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 400, "tripleprice": 1200, "sellprice": 120,
"class": "item", "quantity": 0,
"description": "The crystallized heart of an abyss demon. Radiates profound demonic will.",
"id": "abyssalheartcore"
}>>
<<set $voidcorruptiontear to {
"name": "Void Corruption Tear",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 550, "tripleprice": 1650, "sellprice": 165,
"class": "item", "quantity": 0,
"description": "A tear crystallized from a corrupted divine beast. The pinnacle of demonic ingredients.",
"id": "voidcorruptiontear"
}>>
<<set $demonicqidust to {
"name": "Demonic Qi Dust",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 60, "tripleprice": 180, "sellprice": 18,
"class": "item", "quantity": 0,
"description": "Fine dust suffused with demonic qi. A base material for dark concoctions.",
"id": "demonicqidust"
}>>
<<set $sinfleshpowder to {
"name": "Sin Flesh Powder",
"strength": 0, "agility": 0, "willpower": 0, "armor": 0,
"health": 0, "energy": 0, "evadescore": 0,
"price": 250, "tripleprice": 750, "sellprice": 75,
"class": "item", "quantity": 0,
"description": "Ground from the flesh of a cultivator who fell fully to the demonic path.",
"id": "sinfleshpowder"
}>><<if $corruption >= $equippedRobe.corruptionLock and $corruption >= $equippedUnderwear.corruptionLock>>
<<link "Go back" $passage>><</link>>
<<else>>
<i>I should probably put some clothes on ...</i>
<</if>>
<<nobr>>
<div class="tab-nav">
<<link "Items">><<goto "Inventory">><<set $pe to 0>><</link>><<link "Potions">><<goto "Inventory">><<set $pe to 1>><</link>><<link "Equipment">><<goto "Inventory">><<set $pe to 2>><</link>>
</div>
<<if $pe eq 0>>
<div class="spatial-ring-container">
<div class="inventory-header">
<h2>Your Spatial Ring</h2>
<p>Treasures and materials harvested from the myriad realms, stored within this ancient spatial artifact.</p>
</div>
<div class="wealth-display">
<div class="gold-icon">灵</div>
<div class="gold-amount"><<print $gold>> Spirit Stones</div>
<<set _totalItems to 0>>
<<for _item range $playeriteminventory>>
<<set _totalItems += _item.quantity>>
<</for>>
<br>Current carrying capacity: <<= _totalItems>> / <<print $playeriteminventorybaselimit>>
</div>
<<if $playeriteminventory.length gt 0>>
<table class="item-inventory-table">
<thead>
<tr>
<th style="width: 80px;"></th>
<th>Item</th>
<th style="width: 120px; text-align: center;">Quantity</th>
</tr>
</thead>
<tbody>
<<for _item range $playeriteminventory>>
<tr class="item-row">
<td style="text-align: center;">
<<if _item.quantity gt 0>><div class="item-icon">宝</div> <!-- Replace with actual <img> later -->
<</if>>
</td>
<td>
<<if _item.quantity gt 0>> <div class="item-name"><<print _item.name>></div><</if>>
<<if _item.description neq null>>
<<if _item.quantity gt 0>><div class="item-desc"><<print _item.description>></div><</if>>
<</if>>
</td>
<td style="text-align: center;">
<<if _item.quantity gt 0>><div class="quantity-glow"><<print _item.quantity>></div><</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-ring">
<p>Your spatial ring is empty.</p>
<p>Slay spirit beasts, gather heavenly herbs, and plunder ruins to fill it with immortal treasures.</p>
</div>
<</if>>
</div>
<<elseif $pe eq 1>>
<div class="elixir-pouch-container">
<div class="inventory-header">
<h2>Your Elixir Pouch</h2>
<p>Precious pills and spiritual elixirs gathered on your path to immortality.</p>
</div>
<div id="log"></div>
<<if $playerpotioninventory.length gt 0>>
<table class="elixir-inventory-table">
<thead>
<tr>
<th style="width: 80px;"></th>
<th>Elixir</th>
<th style="width: 100px; text-align: center;">Grade</th>
<th style="width: 100px; text-align: center;">Quantity</th>
<th style="width: 120px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _potion range $playerpotioninventory>>
<<set _rarityColor to
(_potion.grade <= 1 ? "#4fc3f7" :
_potion.grade <= 3 ? "#66bb6a" :
_potion.grade <= 5 ? "#ffa726" :
"#ab47bc") >> <!-- Blue → Green → Orange → Purple -->
<tr class="elixir-row">
<td style="text-align: center;">
<div class="elixir-icon">丹</div> <!-- Replace with <img src="your-icon-url.webp"> later -->
</td>
<td>
<div class="item-name" style="color: <<print _rarityColor>>;"><<print _potion.name>></div>
<<if _potion.description neq null>>
<div class="item-desc"><<print _potion.description>></div>
<</if>>
</td>
<td style="text-align: center; color: <<print _rarityColor>>; font-weight: bold;">
Grade <<print _potion.grade>>
</td>
<td style="text-align: center;">
<div class="quantity-glow"><<print _potion.quantity>></div>
</td>
<td style="text-align: center;">
<<capture _potion>>
<<link "Consume">>
<<set $selectedPotion to _potion>>
<<if _potion.quantity lte 0>>
<<set $playerpotioninventory.deleteAt($playerpotioninventory.indexOf(_potion))>>
<</if>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Spiritual qi surges!</span><br>
You consume the <<print _potion.name>>. A warm current flows through your meridians...
</div>
<</replace>>
<<useItem>> <!-- Apply your custom effect macro here -->
<</link>>
<</capture>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-pouch">
<p>Your elixir pouch is empty.</p>
<p>Seek out rare spirit-herbs and profound catalysts to sustain your journey toward immortality.</p>
</div>
<</if>>
<div id="use-log" class="log-area"></div>
</div>
<<elseif $pe eq 2>>
<div class="equipment-container">
<div class="equipment-header">
<h2>Heavenly Armory</h2>
<p>Equip spiritual artifacts and sacred garments to enhance your path to ascension.</p>
</div>
<div class="equipment-grid">
<!-- Robe Slot -->
<div class="equip-slot">
<div class="slot-title">🛡️ Outer Robes</div>
<<if $equippedRobe neq null>>
<div class="equipped-item">
<div class="item-name"><<print $equippedRobe.name>></div>
<div class="item-desc"><<print $equippedRobe.description>></div>
<div class="item-stats">
<<if $equippedRobe.stats neq null>>
<<set _keys to Object.keys($equippedRobe.stats)>>
<<for _i to 0; _i lt _keys.length; _i++>>
<<set _stat to _keys[_i]>>
<<set _val to $equippedRobe.stats[_stat]>>
+<<print _val>> <<print _stat.charAt(0).toUpperCase() + _stat.slice(1)>><br>
<</for>>
<<else>>
No stat bonuses
<</if>>
</div>
<<if $equippedRobe.durability neq null>>
<div>Durability: <<print $equippedRobe.durability>> / <<print $equippedRobe.maxDurability>></div>
<div class="durability-bar">
<div class="durability-fill" style="width: <<print ($equippedRobe.durability / $equippedRobe.maxDurability * 100)>>%;"></div>
</div>
<</if>>
<<if $equippedRobe.name neq "Naked State">><<link "Unequip" "Inventory">><<set $equippedRobe to $nakedState>><</link>><</if>>
</div>
<<else>>
<div class="empty-slot">No robe equipped</div>
<</if>>
<hr style="border:1px dashed #ffd700; margin:20px 0;">
<strong>Available:</strong><br>
<<if $robeInventory neq null && $robeInventory.length gt 0>>
<<for _item range $robeInventory>>
<<capture _item>>
<<if $equippedRobe neq null && $equippedRobe.name is _item.name>>
<span style="color:#888; font-style:italic;"><<print _item.name>> (equipped)</span><br>
<<else>>
<<link "<<print _item.name>>" "Inventory">>
<<set $equippedRobe to _item>>
<</link>><br>
<</if>>
<</capture>>
<</for>>
<<else>>
<i>No robes in inventory</i>
<</if>>
</div>
<!-- Underwear Slot -->
<div class="equip-slot">
<div class="slot-title">🌸 Intimate Layer</div>
<<if $equippedUnderwear neq null>>
<div class="equipped-item">
<div class="item-name"><<print $equippedUnderwear.name>></div>
<div class="item-desc"><<print $equippedUnderwear.description>></div>
<div class="item-stats">
<<if $equippedUnderwear.stats neq null>>
<<set _keys to Object.keys($equippedUnderwear.stats)>>
<<for _i to 0; _i lt _keys.length; _i++>>
<<set _stat to _keys[_i]>>
<<set _val to $equippedUnderwear.stats[_stat]>>
+<<print _val>> <<print _stat.charAt(0).toUpperCase() + _stat.slice(1)>><br>
<</for>>
<<else>>
No stat bonuses
<</if>>
</div>
<<if $equippedUnderwear.name neq "No Underwear">><<link "Unequip" "Inventory">><<set $equippedUnderwear to $noUnderwear>><</link>><</if>>
</div>
<<else>>
<div class="empty-slot">None worn</div>
<</if>>
<hr style="border:1px dashed #ffd700; margin:20px 0;">
<strong>Available:</strong><br>
<<if $underwearInventory neq null && $underwearInventory.length gt 0>>
<<for _item range $underwearInventory>>
<<capture _item>>
<<if $equippedUnderwear neq null && $equippedUnderwear.name is _item.name>>
<span style="color:#888; font-style:italic;"><<print _item.name>> (equipped)</span><br>
<<else>>
<<link "<<print _item.name>>" "Inventory">>
<<set $equippedUnderwear to _item>>
<</link>><br>
<</if>>
<</capture>>
<</for>>
<<else>>
<i>No intimate garments in inventory</i>
<</if>>
</div>
<!-- Weapon Slot -->
<div class="equip-slot">
<div class="slot-title">⚔️ Signature Weapon</div>
<<if $equippedWeapon neq null>>
<div class="equipped-item">
<div class="item-name"><<print $equippedWeapon.name>></div>
<div class="item-desc"><<print $equippedWeapon.description>></div>
<div class="item-stats">
<<if $equippedWeapon.stats neq null>>
<<set _keys to Object.keys($equippedWeapon.stats)>>
<<for _i to 0; _i lt _keys.length; _i++>>
<<set _stat to _keys[_i]>>
<<set _val to $equippedWeapon.stats[_stat]>>
+<<print _val>> <<print _stat.charAt(0).toUpperCase() + _stat.slice(1)>><br>
<</for>>
<<else>>
No stat bonuses
<</if>>
</div>
<<link "Unequip" "Inventory">><<set $equippedWeapon to null>><</link>>
</div>
<<else>>
<div class="empty-slot">Unarmed</div>
<</if>>
<hr style="border:1px dashed #ffd700; margin:20px 0;">
<strong>Available:</strong><br>
<<if $weaponInventory neq null && $weaponInventory.length gt 0>>
<<for _item range $weaponInventory>>
<<capture _item>>
<<if $equippedWeapon neq null && $equippedWeapon.name is _item.name>>
<span style="color:#888; font-style:italic;"><<print _item.name>> (equipped)</span><br>
<<else>>
<<link "<<print _item.name>>" "Inventory">>
<<set $equippedWeapon to _item>>
<</link>><br>
<</if>>
<</capture>>
<</for>>
<<else>>
<i>No weapons in inventory</i>
<</if>>
</div>
<!-- Accessories (3 slots) -->
<div class="equip-slot">
<div class="slot-title">💎 Accessories (3 slots)</div>
<<if $equippedAccessories neq null>>
<<for _i to 0; _i lt 3; _i++>>
<<set _acc to $equippedAccessories[_i]>>
<<capture _i, _acc>>
<<if _acc neq null>>
<div class="equipped-item" style="margin-bottom:15px;">
<div class="item-name">Slot <<print _i + 1>>: <<print _acc.name>></div>
<div class="item-desc"><<print _acc.description>></div>
<div class="item-stats">
<<if _acc.stats neq null>>
<<set _keys to Object.keys(_acc.stats)>>
<<for _j to 0; _j lt _keys.length; _j++>>
<<set _stat to _keys[_j]>>
<<set _val to _acc.stats[_stat]>>
+<<print _val>> <<print _stat.charAt(0).toUpperCase() + _stat.slice(1)>><br>
<</for>>
<<else>>
No stat bonuses
<</if>>
</div>
<<link "Unequip" "Inventory">><<set $equippedAccessories[_i] to null>><</link>>
</div>
<<else>>
<div class="empty-slot">Slot <<print _i + 1>>: Empty</div>
<</if>>
<</capture>>
<</for>>
<<else>>
<div class="empty-slot">No accessories equipped</div>
<</if>>
<hr style="border:1px dashed #ffd700; margin:20px 0;">
<strong>Available:</strong><br>
<<if $accessoryInventory neq null && $accessoryInventory.length gt 0>>
<<for _item range $accessoryInventory>>
<<capture _item>>
<<set _alreadyEquipped to false>>
<<set _equippedSlot to -1>>
<<if $equippedAccessories neq null>>
<<for _i to 0; _i lt 3; _i++>>
<<set _equippedAcc to $equippedAccessories[_i]>>
<<if _equippedAcc neq null && _equippedAcc.name is _item.name>>
<<set _alreadyEquipped to true>>
<<set _equippedSlot to _i>>
<<break>>
<</if>>
<</for>>
<</if>>
<<if _alreadyEquipped>>
<span style="color:#888; font-style:italic;"><<print _item.name>> (equipped in Slot <<print _equippedSlot + 1>>)</span><br>
<<else>>
<<set _freeSlot to -1>>
<<if $equippedAccessories neq null>>
<<for _i to 0; _i lt 3; _i++>>
<<if $equippedAccessories[_i] is null>>
<<set _freeSlot to _i>>
<<break>>
<</if>>
<</for>>
<</if>>
<<if _freeSlot gte 0>>
<<link "<<print _item.name>> → Slot <<print _freeSlot + 1>>" "Inventory">>
<<set $equippedAccessories[_freeSlot] to _item>>
<</link>><br>
<<else>>
<span style="color:#c66;">(All slots full)</span><br>
<</if>>
<</if>>
<</capture>>
<</for>>
<<else>>
<i>No accessories in inventory</i>
<</if>>
</div>
</div>
</div>
<</if>>
<</nobr>><<set $jadeprobe to {
id: "jadeprobe",
name: "Jade Meridian Probe",
description: "A thick, perfectly smooth jade dildo carved to stimulate deep internal meridians. Warms and pulses with channeled qi — designed for intense solo masturbation and yin essence refinement.",
price: 280,
sellprice: 70,
class: "toy",
lewd: true,
effect: "soloPenetration"
}>>
<<set $phoenixfeatherplug to {
id: "phoenixfeatherplug",
name: "Phoenix Feather Anal Plug",
description: "Tapered jade plug with soft phoenix feather tail. Inserted anally, it sends waves of warm yang fire through rear meridians - perfect for prolonged anal masturbation and forbidden pleasure cultivation.",
price: 320,
sellprice: 80,
class: "toy",
lewd: true,
effect: "analPlay"
}>>
<<set $lotusbeads to {
id: "lotusbeads",
name: "Lotus Prayer Beads",
description: "String of graduated rose quartz beads for progressive anal or vaginal insertion. Each bead vibrates with yin qi when pulled - ideal for extended masturbation sessions and meridian stretching.",
price: 350,
sellprice: 90,
class: "toy",
lewd: true,
effect: "beadInsertion"
}>>
<<set $merchantInventory to []>>
<<set $mysteriouspillforgeInventory to []>>
<<set $mysteriouspillforgePillRecipeInventory to []>>
<<set $mysteriouspillforgeInventory.push($strengthboostpotion1)>>
<<set $mysteriouspillforgePillRecipeInventory.push($strengthboostrecipe2, $agilityboostrecipe1, $agilityboostrecipe2, $willpowerboostrecipe1, $willpowerboostrecipe2, $charismaboostrecipe2, $luckboostrecipe1, $luckboostrecipe2, $insightboostrecipe1, $maxhealthrecipe1, $maxenergyrecipe1, $martialartsrecipe1, $armorboostrecipe1,
)>>
<<set $thunderclapswordforgeInventory to []>>
<<set $thunderclapswordforgeInventory.push($crimsonlotussword, $jadewhip, $phoenixfan
)>>
<<set $blissfurnacepavilionInventory to []>>
<<set $blissfurnacepavilionInventory.push($corruptionelixir, $succubusbreath, $forbiddenyangseed
)>>
<!-- Wandering merchants -->
<<set $wanderingMerchantInventory to []>>
<<set $wanderingMerchantInventory.push($copperskinpowder, $crimsonhideflake, $burningsandresin, $titanapehair, $spiritvinetendril)>>/* NPC stat table */
<<widget "BookOfConnections_npcStats">>
<<if !$currentNPC.isDead>>
<div class="stat-table-container">
<table class="stat-table">
<tr>
<th>General</th>
<th>Combat</th>
</tr>
<tr>
<td>
<b>🧬 Lifespan:</b> <<print $currentNPC.NPClifespan>> / <<print $currentNPC.NPCmaxlifespan>><br>
<b>❤️ Health:</b> <<print $currentNPC.NPCcurrenthealth>> / <<print $currentNPC.NPCmaxhealth>><br>
<b>⚡ Energy:</b> <<print $currentNPC.NPCcurrentenergy>> / <<print $currentNPC.NPCmaxenergy>><br>
<b>🍀 Luck:</b> <<print $currentNPC.NPCluck>><br>
<b>🧠 Insight:</b> <<print $currentNPC.NPCinsight>><br>
<b>💪 Strength:</b> <<print $currentNPC.NPCbasestrength>><br>
<b>🌀 Willpower:</b> <<print $currentNPC.NPCbasewillpower>>
</td>
<td>
<b>🗡️ Attack:</b> <<print $currentNPC.NPCatk>><br>
<b>🛡️ Defense:</b> <<print $currentNPC.NPCdef>><br>
<b>💥 Crit Rate:</b> <<print $currentNPC.NPCcrit>>%<br>
<b>🛑 Crit Resist:</b> <<print $currentNPC.NPCcritres>>%<br>
<b>👟 Agility:</b> <<print $currentNPC.NPCagility>><br>
<b>🥋 Martial Arts:</b> <<print $currentNPC.NPCmartialArts>><br>
<b>🌌 Spiritual Root:</b> <<print $currentNPC.NPCspiritualRoot>>
</td>
</tr>
</table>
</div>
<<else>>
<</if>>
<</widget>>
/* NPC family tree */
<<widget "DrawConnectionMap">>
<<set _focus to $args[0]>>
<<set _rel to _focus.relations || {}>>
<div class="scroll-tree">
<div class="tree-row">
<<if (_rel.masters || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Master<<if _rel.masters.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.masters>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>><<MiniCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
<<if (_rel.parents || []).length gt 0>>
<<for _id range _rel.parents>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>>
<div class="relation-group">
<div class="relation-label"><<print (_r.gender === "male" ? "Father" : "Mother")>></div>
<div class="card-container"><<MiniCard _r>></div>
</div>
<</if>>
<</for>>
<</if>>
</div>
<div class="tree-row">
<<if (_rel.spouses || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Spouse<<if _rel.spouses.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.spouses>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
<<if (_rel.lovers || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Lover<<if _rel.lovers.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.lovers>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
<div class="npc-mini-card focus">
<div style="font-weight:bold; color:#b22222;">
<<if _focus.isDead>>✟ <</if>><<= _focus.fullname>>
</div>
<div style="font-size:0.75em; color:#666;">(Focus)</div>
</div>
<<if (_rel.siblings || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Sibling<<if _rel.siblings.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.siblings>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<div class="tree-row">
<<if (_rel.children || []).length gt 0>>
<<for _id range _rel.children>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>>
<div class="relation-group">
<div class="relation-label"><<print (_r.gender === "male" ? "Son" : "Daughter")>></div>
<div class="card-container"><<MiniCard _r>></div>
</div>
<</if>>
<</for>>
<</if>>
<<if (_rel.apprentices || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Apprentice<<if _rel.apprentices.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.apprentices>>
<<if _id eq "player">>
<<set _r to { id:"player", fullname:"You", gender:$playerGender, isPlayer:true }>>
<<else>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r and $encounterBatch>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<<if (_rel.parents || []).length == 0 and (_rel.siblings || []).length == 0 and (_rel.masters || []).length == 0 and (_rel.apprentices || []).length == 0 and (_rel.children || []).length == 0 and (_rel.spouses || []).length == 0 and (_rel.lovers || []).length == 0>>
<div style="text-align:center; padding:40px; color:#819ca9; font-style:italic;">
No known connections... The threads of fate around this one remain hidden.
</div>
<</if>>
</div>
<</widget>>
/* NPC mini card for lists and connections */
<<widget "MiniCard">>
<<set _npc to $args[0]>>
<div @class="'npc-mini-card' + (_npc.isDead ? ' dead-npc' : '')">
<<if _npc.isPlayer>>
<div style="text-align:center;">
<span class="treegrid link-red">
<b><<link "You" "Status">><</link>></b>
</span>
</div>
<<else>>
<span class="treegrid">@@.link-brown;
<<capture _npc>>
<<link _npc.fullname "RelationsDetailed">>
<<set $selectedNPCid to _npc.id>>
<img @src="'images/' + _npc.enemyregion + '/' + _npc.enemyimage + '.jpg'">
<</link>>
<</capture>>
@@</span>
<</if>>
</div>
<</widget>>
/* Batch NPC encounter widget */
<<widget "GenerateEncounterBatch">>
<<set _locationType to $args[0]>>
<<set _specificSect to $args[1] || null>>
<<set $encounterBatch to {}>>
<<set _possibleRelatives to []>>
<<set _familiarCount to 0>>
<<set _unknownCount to 0>>
<!-- Determine batch size based on location -->
<<set _batchSize to 0>>
<<switch _locationType>>
<<case "tavern">> <<set _batchSize to random(5, 8)>>
<<case "sect">> <<set _batchSize to random(6, 10)>>
<<case "mortal">> <<set _batchSize to random(4, 7)>>
<<case "wilderness">> <<set _batchSize to random(2, 4)>>
<<default>> <<set _batchSize to random(3, 6)>>
<</switch>>
<!-- FAMILIAR FACES (20-40% of batch) -->
<<set _familiarPercentage to 20>>
<<set _targetFamiliarCount to Math.floor(_batchSize * _familiarPercentage / 100)>>
<<set _targetFamiliarCount to Math.max(1, Math.min(3, _targetFamiliarCount))>>
<!-- Gather possible familiars (relatives + known but unmet NPCs) -->
<<set _possibleFamiliars to []>>
<!-- Add relatives of known NPCs -->
<<set _knownMetList to $known_npc_list.filter(function(n) { return n.isMet and !n.isDead; })>>
<<for _known range _knownMetList>>
<<if _known.relations>>
<<set _relTypes to ["masters", "parents", "spouses", "siblings", "apprentices", "children"]>>
<<for _type range _relTypes>>
<<if _known.relations[_type] and _known.relations[_type].length gt 0>>
<<for _relId range _known.relations[_type]>>
<<set _rel to ($encounterBatch[_relId] || $known_npc_list.find(function(n) { return n.id === _relId; }))>>
<<if _rel and !_rel.isMet and !_rel.isDead>>
<<set _possibleFamiliars.push(_rel)>>
<</if>>
<</for>>
<</if>>
<</for>>
<</if>>
<</for>>
<!-- Also add any unmet NPCs from known_npc_list -->
<<set _unmetList to $known_npc_list.filter(function(n) { return !n.isMet and !n.isDead; })>>
<<for _unmet range _unmetList>>
<<set _found to false>>
<<for _fam range _possibleFamiliars>>
<<if _fam.id is _unmet.id>>
<<set _found to true>>
<</if>>
<</for>>
<<if not _found>>
<<set _possibleFamiliars.push(_unmet)>>
<</if>>
<</for>>
<!-- Select familiars if available -->
<<if _possibleFamiliars.length gt 0>>
<<set _familiarCount to Math.min(_targetFamiliarCount, _possibleFamiliars.length)>>
<<for _i = 0; _i lt _familiarCount; _i++>>
<<set _chosen to _possibleFamiliars.random()>>
<<set _chosen.isFamiliar to true>>
<!-- Check if this is a relative -->
<<set _isRel to false>>
<<for _known range _knownMetList>>
<<if _known.relations>>
<<set _relTypes to ["masters", "parents", "spouses", "siblings", "apprentices", "children"]>>
<<for _type range _relTypes>>
<<if _known.relations[_type] and _known.relations[_type].includes(_chosen.id)>>
<<set _isRel to true>>
<</if>>
<</for>>
<</if>>
<</for>>
<<set _chosen.isRelative to _isRel>>
<<set $encounterBatch[_chosen.id] to _chosen>>
<!-- Remove from pool to avoid duplicates -->
<<set _newFamiliars to []>>
<<for _fam range _possibleFamiliars>>
<<if _fam.id != _chosen.id>>
<<set _newFamiliars.push(_fam)>>
<</if>>
<</for>>
<<set _possibleFamiliars to _newFamiliars>>
<</for>>
<</if>>
<!-- Fill remaining with UNKNOWN NPCs -->
<<set _unknownCount to _batchSize - _familiarCount>>
<<for _i = 0; _i lt _unknownCount; _i++>>
<!-- Determine realm and stage based on location -->
<<set _realmName = "">>
<<set _stageName = "">>
<<switch _locationType>>
<<case "mortal">>
<<set _realmName = "Mortal">>
<<set _stageName = "">>
<<case "sect">>
<<set _realmOptions to ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"]>>
<<set _stageOptions to ["Early","Middle","Late"]>>
<<set _realmName to _realmOptions.random()>>
<<set _stageName to _stageOptions.random()>>
<<case "wilderness">>
<<set _realmOptions to ["Body Tempering Realm", "Meridian Awakening Realm"]>>
<<set _stageOptions to ["Early","Middle","Late"]>>
<<set _realmName to _realmOptions.random()>>
<<set _stageName to _stageOptions.random()>>
<<default>> <!-- tavern -->
<<set _realmOptions to ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"]>>
<<set _stageOptions to ["Early","Middle","Late"]>>
<<set _realmName to _realmOptions.random()>>
<<set _stageName to _stageOptions.random()>>
<</switch>>
<!-- Compute power using the correct variables -->
<<set _power = $power[_realmName][_stageName]>>
<!-- Generate NPC based on realm -->
<<set _gender to ["male","female"].random()>>
<<set _name to "">>
<<if _gender eq "male">>
<<set _name to $male_npc_names.random()>>
<<else>>
<<set _name to $female_npc_names.random()>>
<</if>>
<<set _surname to $npc_surnames.random()>>
<<set _fullname to _surname + " " + _name>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<if _realmName neq "Mortal">>
/* Cultivator — use CreateNPC001 */
<<CreateNPC001>>
<<if _locationType eq "sect">>
<<set _npc.sectNPC to (_specificSect || "Unaffiliated")>>
<<set _npc.NPCrank to (_specificSect ? ["Disciple","Inner Disciple","Elder"].random() : "Cultivator")>>
<<set _npc.NPClocation to (_specificSect || $region)>>
<</if>>
<<else>>
<!-- Mortal NPC -->
<<set _npc to {
id: random(0, 10000) + Date.now() + _i,
name: _name,
power: _power,
surname: _surname,
fullname: _fullname,
gender: _gender,
realm: "Mortal",
NPCrank: "Commoner",
sectNPC: "Unaffiliated",
NPClocation: $region + " Village",
enemyregion: "Enemy",
enemyimage: ["enemy1", "enemy2", "enemy3", "enemy4"].random(),
NPCmaxlifespan: random(60, 80),
NPClifespan: random(18, 60),
NPCmaxhealth: random(80, 120),
NPCcurrenthealth: random(80, 120),
NPCmaxenergy: random(40, 60),
NPCcurrentenergy: random(40, 60),
NPCluck: random(1, 3),
NPCinsight: random(1, 3),
NPCbasestrength: random(1, 3),
NPCbasewillpower: random(1, 3),
NPCatk: random(5, 10),
NPCdef: random(1, 3),
NPCcrit: 0,
NPCcritres: 0,
NPCagility: random(2, 4),
NPCmartialArts: 0,
NPCspiritualRoot: 0,
RightTendencies: random(100,200),
DemonTendencies: random(100,200),
depravity: random(1, 10),
friendship: 0,
charm: 5,
talk: 0,
hadSex: 0,
deathCause: null, /* "old_age", "murder", "revenge_killed", etc.*/
killedByPlayer: false,
killedInRevenge: false, /* true if killed during a revenge encounter*/
deathGrudgeType: null, /* the type of grudge they were avenging*/
deathGrudgeVictim: null, /* the victim they were avenging*/
isMet: false,
isDead: false,
isFamiliar: false,
isRelative: false,
isUnknown: true,
hasGrudge: false,
relations: { parents: [], masters: [], spouses: [], siblings: [], children: [], apprentices: [] }
}>>
<</if>>
<<set $encounterBatch[_npc.id] to _npc>>
<</for>>
<!-- Store metadata -->
<<set $encounterMetadata to {
locationType: _locationType,
specificSect: _specificSect,
familiarCount: _familiarCount,
unknownCount: _unknownCount,
totalSize: _batchSize
}>>
<</widget>>
<<widget "DisplayEncounter">>
<<RelocationNpcPosition>>
<<set _batch to $encounterBatch>>
<<set _meta to $encounterMetadata || {}>>
<<set $PlayerLocation to $region>> /* Use your actual player location variable */
<<set _currentpassage to passage()>>
<!-- Count relatives for display -->
<<set _relativeCount to 0>>
<<for _id, _npc range _batch>>
<<if _npc.isRelative>>
<<set _relativeCount to _relativeCount + 1>>
<</if>>
<</for>>
<!-- Find known NPCs at this location -->
<<set _knownAtLocation to []>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<set _knownNPC to $known_npc_list[_i]>>
<<if _knownNPC.NPClocation eq $PlayerLocation and !_knownNPC.isDead>>
<<set _knownAtLocation.push(_knownNPC)>>
<</if>>
<</for>>
<!-- Dynamic title -->
<<switch _meta.locationType>>
<<case "tavern">>
<h3>✦ Tavern ✦</h3>
<p class="location-desc">The smell of wine and spirit beasts fills the air...</p>
<<case "sect">>
<h3>✦ <<print _meta.specificSect || "The Sect">> Grounds ✦</h3>
<p class="location-desc">Disciples practice forms as elders pass by...</p>
<<case "mortal">>
<h3>✦ Mortal Village Market ✦</h3>
<p class="location-desc">Ordinary folk go about their day, unaware of cultivation...</p>
<<case "wilderness">>
<h3>✦ Wild Mountains ✦</h3>
<p class="location-desc">Dangerous aura permeates the air...</p>
<</switch>>
<!-- Stats bar - compact -->
<div class="encounter-stats-bar">
<span class="stat-pill">Total: <<print _meta.totalSize + _knownAtLocation.length>></span>
<<if _meta.familiarCount gt 0>>
<span class="stat-pill familiar">Familiar: <<print _meta.familiarCount>></span>
<</if>>
<<if _meta.unknownCount gt 0>>
<span class="stat-pill unknown">Unknown: <<print _meta.unknownCount>></span>
<</if>>
<<if _knownAtLocation.length gt 0>>
<span class="stat-pill known">Known: <<print _knownAtLocation.length>></span>
<</if>>
<<if _relativeCount gt 0>>
<span class="stat-pill bloodline">Bloodline: <<print _relativeCount>></span>
<</if>>
</div>
<div class="encounter-grid">
<!-- First display known NPCs at this location -->
<<for _known range _knownAtLocation>>
<<capture _known>>
<div class="encounter-card known-card">
<!-- Top row: Name/rank and indicator -->
<div class="card-header">
<span class="card-title">
<<print _known.fullname>>
</span>
<<if _known.relations and ( _known.relations.parents.length gt 0 or _known.relations.siblings.length gt 0 or _known.relations.spouses.length gt 0 )>>
<span class="card-badge bloodline" title="Has family connections">⚡</span>
<</if>>
</div>
<!-- Middle: Realm -->
<div class="card-realm">
<<if _known.realm>>
<<print _known.realm>>
<<else>>
Commoner
<</if>>
</div>
<!-- Bottom: Sect (if any) -->
<<if _known.sectNPC and _known.sectNPC neq "Unaffiliated">>
<div class="card-sect" title="<<print _known.sectNPC>>">
<<print _known.sectNPC.split(" ").slice(0,2).join(" ")>>
</div>
<</if>>
<!-- Approach link -->
<div class="card-action">
<<link "Approach">>
<<set $currentEncounterNPC to _known>>
<<set $encounterOrigin to _meta.locationType>>
<<goto "EncounterInteraction">>
<</link>>
</div>
</div>
<</capture>>
<</for>>
<!-- Then display unknown/batch NPCs -->
<<for _id, _npc range _batch>>
<<capture _npc>>
<div class="encounter-card">
<!-- Top row: Name/rank and indicator -->
<div class="card-header">
<span class="card-title">
<<if _npc.isUnknown>>
???
<<else>>
<<if _npc.realm eq "Mortal">>
Mortal
<<else>>
<<print _npc.NPCrank || "Cultivator">>
<</if>>
<</if>>
</span>
<<if _npc.isFamiliar and !_npc.isUnknown>>
<span class="card-badge <<if _npc.isRelative>>bloodline<<else>>familiar<</if>>">
<<if _npc.isRelative>>⚡<<else>>✦<</if>>
</span>
<</if>>
</div>
<!-- Middle: Realm (compact) -->
<div class="card-realm">
<<if !_npc.isUnknown and _npc.realm and _npc.realm neq "Mortal">>
<<print _npc.realm>>
<<elseif !_npc.isUnknown and _npc.realm eq "Mortal">>
Commoner
<<else>>
<span class="unknown-text">???</span>
<</if>>
</div>
<!-- Bottom: Sect (if any) -->
<<if !_npc.isUnknown and _npc.sectNPC and _npc.sectNPC neq "Unaffiliated">>
<div class="card-sect" title="<<print _npc.sectNPC>>">
<<print _npc.sectNPC.split(" ").slice(0,2).join(" ")>>
</div>
<</if>>
<!-- Approach link -->
<div class="card-action">
<<link "Approach">>
<<set $currentEncounterNPC to _npc>>
<<set $encounterOriginPassage to passage()>>
<<goto "EncounterInteraction">>
<</link>>
</div>
</div>
<</capture>>
<</for>>
</div>
<!-- Refresh option -->
<div class="encounter-actions">
<<if $energy gte 10>>
<<link "⟳ Wait" _currentpassage>>
<<GenerateEncounterBatch _meta.locationType _meta.specificSect>>
<<DisplayEncounter>>
<</link>>
<</if>>
</div>
<</widget>><<widget "RelationshipType">>
<<if _npc neq null>>
<<if _npc.relationshipType is "enemy">>
Enemy
<<elseif _npc.relationshipType is "lover" and _npc.hadSex neq null and _npc.hadSex eq 1>>
Lover
<<elseif _npc.mentorshipType neq null and _npc.mentorshipType eq 1>>
Master
<<elseif _npc.mentorshipType neq null and _npc.mentorshipType eq 2>>
Apprentice
<<elseif _npc.friendship neq null and _npc.talk neq null and _npc.friendship gte 30 and _npc.friendship lt 70>>
Friend
<<elseif _npc.friendship neq null and _npc.talk neq null and _npc.friendship lt 20 and _npc.talk lt 3>>
Stranger
<<else>>
Acquaintance
<</if>>
<<else>>
Stranger
<</if>>
<</widget>>
<<widget "NPCMeter">>
<<set _percent = Math.clamp(($args[0] / $args[1]) * 100, 0, 100)>>
<div class="meter-container">
<div class="meter-label">_args[2]: $args[0] / $args[1]</div>
<div class="meter-bg">
<div class="meter-fill" @style="'width: ' + _percent + '%; background-color: ' + $args[3] + ';'"></div>
</div>
</div>
<</widget>>
<<widget "NpcPosition">>
<<if $turns % 12 == 0>>
<<for _ab range $known_npc_list>>
<<set _ab.NPClocation = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Ghost King Netherworld Sect", "Clear Sky Azure Dragon Pavilion"].random()>>
<</for>>
<</if>>
<</widget>>
<<widget "RelocationNpcPosition">>
<<set _roll to random(1, 100)>>
<<if _roll lte 30>>
<<for _ab range $known_npc_list>>
<<set _ab.NPClocation = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Ghost King Netherworld Sect", "Clear Sky Azure Dragon Pavilion"].random()>>
<</for>>
<</if>>
<</widget>>
<<widget "BattleAddNPC">>\
<<run $known_npc_list.push($currentEnemy)>>\
<</widget>>\
<<widget "AddNPC">>\
<<run $known_npc_list.push(_npc)>>\
<</widget>>\
<<widget "RemoveNPC">>
<<capture _npc>>
<<for _i to 0; _i < $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id is _npc.id>>
<<run $known_npc_list.deleteAt(_i)>>
<<break>>
<</if>>
<</for>>
/* Optional: Reset page if list becomes empty or current page is invalid */
<<if $known_npc_list.length is 0 or $relationPage > Math.ceil($known_npc_list.length / 3)>>
<<set $relationPage to 1>>
<</if>>
<</capture>>
<</widget>>
<<widget "AddNPCWithFamily">>
<<silently>>
<<set _mainNPC to $args[0]>>
/* 1. Automatically mark the main NPC as met and known */
<<set _mainNPC.isMet to true>>
<<set _mainNPC.isUnknown to false>>
/* 2. Safety Check: Only push if they aren't already in the list */
<<if !$known_npc_list.some(function(n) { return n.id === _mainNPC.id; })>>
<<run $known_npc_list.push(_mainNPC)>>
<<else>>
/* If they somehow already exist, update their data instead of duplicating */
<<set _idx to $known_npc_list.findIndex(function(n) { return n.id === _mainNPC.id; })>>
<<run Object.assign($known_npc_list[_idx], _mainNPC)>>
<</if>>
/* Store current batch */
<<set _tempBatch to $encounterBatch>>
/* Generate family - this creates a fresh $encounterBatch */
<<GenerateLineageBatch _mainNPC>>
/* 3. Add all family members (keeping them unknown until the player actually meets them) */
<<for _id, _family range $encounterBatch>>
<<if _family.id != _mainNPC.id>>
<<set _family.isMet to false>>
<<set _family.isUnknown to true>>
/* Safety Check for family members too */
<<if !$known_npc_list.some(function(n) { return n.id === _family.id; })>>
<<run $known_npc_list.push(_family)>>
<</if>>
<</if>>
<</for>>
/* Restore original encounter batch */
<<set $encounterBatch to _tempBatch>>
<</silently>>
<</widget>>
<!-- Display NPC's -->
<<widget "DisplayNPCS">>
/* Accept arguments - $args[0] will be the first argument after widget name */
<<set _locationType to $args[0] || "wilderness">> /* Default to "sect" if not provided */
<<set _specificSect to $args[1] || null>> /* Optional second argument */
<<if $peopleVisible is undefined>>
<<set $peopleVisible = false>>
<</if>>
<div id="people-ui">
<<if $peopleVisible>>
<<link "Avert your gaze">>
<<set $peopleVisible = false>>
<<run Engine.play(passage())>>
<</link>>
<div style="margin-top:10px;">
<<DisplayEncounter>>
</div>
<<else>>
<<link "Look around people">>
<<set $peopleVisible = true>>
/* Pass the arguments to GenerateEncounterBatch */
<<GenerateEncounterBatch _locationType _specificSect>>
<<run Engine.play(passage())>>
<</link>>
<</if>>
</div>
<</widget>>
<<widget "UpdateNPCStatsForRealm">>
<<silently>>
<<set _npc = $args[0]>>
<<set _debug = []>> /* For debugging */
/* Safety checks */
<<if not _npc>>
<<set _debug.push("No NPC provided")>>
<<elseif not _npc.realm>>
<<set _debug.push("NPC has no realm property")>>
<</if>>
<<if _debug.length == 0>>
<<set _realmName = _npc.realm.split(" ").slice(0,-1).join(" ")>>
<<set _stageName = _npc.realm.split(" ").pop()>>
<<set _debug.push("Realm: " + _realmName + ", Stage: " + _stageName)>>
/* Check if stats object exists */
<<if not window.GenerationNPCRealmStats and not $GenerationNPCRealmStats>>
<<set _debug.push("ERROR: $GenerationNPCRealmStats is not defined")>>
<<else>>
<<set _statsObj = $GenerationNPCRealmStats || window.GenerationNPCRealmStats>>
<<if not _statsObj[_realmName]>>
<<set _debug.push("ERROR: No stats for realm: " + _realmName)>>
<<elseif not _statsObj[_realmName][_stageName]>>
<<set _debug.push("ERROR: No stats for stage: " + _stageName + " in realm " + _realmName)>>
<<else>>
<<set _stats = _statsObj[_realmName][_stageName]>>
<<set _debug.push("Stats found, updating...")>>
/* Update stats */
<<set _npc.NPCmaxhealth = random(_stats.health[0], _stats.health[1])>>
<<set _npc.NPCcurrenthealth = _npc.NPCmaxhealth>>
<<set _npc.NPCmaxenergy = random(_stats.energy[0], _stats.energy[1])>>
<<set _npc.NPCcurrentenergy = _npc.NPCmaxenergy>>
<<set _npc.NPCluck = random(_stats.luck[0], _stats.luck[1])>>
<<set _npc.NPCinsight = random(_stats.insight[0], _stats.insight[1])>>
<<set _npc.NPCbasestrength = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _npc.NPCbasewillpower = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _npc.NPCatk = random(_stats.atk[0], _stats.atk[1])>>
<<set _npc.NPCdef = random(_stats.def[0], _stats.def[1])>>
<<set _npc.NPCcrit = random(_stats.crit[0], _stats.crit[1])>>
<<set _npc.NPCcritres = random(_stats.critres[0], _stats.critres[1])>>
<<set _npc.NPCagility = random(_stats.agility[0], _stats.agility[1])>>
<<set _npc.NPCmartialArts = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _npc.NPCspiritualRoot = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _npc.NPCmaxlifespan = random(_stats.lifespan[0], _stats.lifespan[1])>>
<<set _debug.push("Update complete")>>
<</if>>
<</if>>
<</if>>
/* Store debug info for display */
<<set $lastStatsDebug = _debug>>
<</silently>>
/* Optionally display debug output */
<<if $debugMode>>
<div style="border:1px solid blue; padding:5px; margin:5px; font-size:small;">
<b>Stats Update Debug:</b><br>
<<for _msg range $lastStatsDebug>>
<<print _msg>><br>
<</for>>
</div>
<</if>>
<</widget>>
<<widget "NPCRumours">>
<<if $known_npc_list.length gt 0>>
<<if random(1,100) lte 20>>
<<set _npc to $known_npc_list.random()>>
<<set _rumourType to random(1,100)>>
<<set _text to "">>
<<if _npc.isDead>>
<<set _rumourType to 95>> /* Redirect to death memory */
<</if>>
<<switch _rumourType>>
<<case 1 to 6>> /* Breakthrough! (6%) */
<<set _stages to ["early", "middle", "late"]>>
<<set _currentStage to _npc.realm.split(" ").pop()>>
<<set _idx to _stages.indexOf(_currentStage)>>
<<if _idx lt 2>>
<<set _newStage to _stages[_idx + 1]>>
<<set _npc.realm to _npc.realm.split(" ").slice(0,-1).join(" ") + " " + _newStage>>
<<UpdateNPCStatsForRealm _npc>>
<<set _text to `Whispers spread like wildfire: ${_npc.fullname} has achieved a breakthrough to ${_newStage}-stage ${_npc.realm.split(" ").slice(0,-1).join(" ")}!`>>
<<else>>
<<set _realms to ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"]>>
<<set _curRealmName to _npc.realm.split(" ").slice(0,-1).join(" ")>>
<<set _curRealmIdx to _realms.indexOf(_curRealmName)>>
<<if _curRealmIdx lt _realms.length - 1>>
<<set _npc.realm to _realms[_curRealmIdx + 1] + " early">>
<<UpdateNPCStatsForRealm _npc>>
<<set _text to `Heavenly phenomena were seen! ${_npc.fullname} has stepped into the ${_realms[_curRealmIdx + 1]}!`>>
<<else>>
<<set _text to `Rumours say ${_npc.fullname} is attempting core formation in seclusion... but nothing confirmed yet.`>>
<</if>>
<</if>>
<<case 7 to 9>> /* Tragic Death (3%) */
<<if !_npc.isDead>>
<<set _npc.isDead to true>>
<<set _npc.deathCause = "murder">>
<<set _npc.killedByPlayer = false>>
<<set _npc.killedInRevenge = false>>
/* If NPC had an active grudge, mention it */
<<if _npc.hasGrudge>>
<<set _text to `A bloodied jade slip arrived from ${_npc.NPClocation}: ${_npc.fullname} perished in a deadly ambush. Some say they were hunting someone... but their vengeance died with them.`>>
<<else>>
<<set _text to `A bloodied jade slip arrived from ${_npc.NPClocation}: ${_npc.fullname} perished in a deadly ambush. Their name fades from the Jianghu...`>>
<</if>>
<</if>>
<<case 10 to 19>> /* Saved villagers / Righteous act (10%) */
<<set _npc.RightTendencies to _npc.RightTendencies + random(15,35)>>
<<set _npc.depravity to Math.max(0, _npc.depravity - random(5,12))>>
<<set _text to `Travellers speak warmly of ${_npc.fullname}, who reportedly saved a mortal village from demonic beasts. Righteous aura grows stronger around them.`>>
<<case 20 to 29>> /* Massacred innocents / Demonic act (10%) */
<<set _npc.DemonTendencies to _npc.DemonTendencies + random(20,40)>>
<<set _npc.depravity to _npc.depravity + random(8,18)>>
<<set _text to `Dark whispers from ${_npc.NPClocation}: ${_npc.fullname} slaughtered an entire caravan of innocents. Blood qi swirls thicker around them now.`>>
<<case 30 to 39>> /* Left/Kicked from sect (10%) */
<<if _npc.sectNPC neq "Unaffiliated">>
<<set _oldSect to _npc.sectNPC>>
<<set _npc.sectNPC to "Unaffiliated">>
<<set _npc.NPCrank to "">>
<<set _text to `Shock in the cultivation world: ${_npc.fullname} has been expelled from the ${_oldSect}! Some say betrayal, others speak of forbidden techniques...`>>
<<else>>
<<set _text to `Merchants gossip that ${_npc.fullname} has taken on a mysterious new disciple in the wilderness.`>>
<</if>>
<<case 40 to 49>> /* Joined a sect (10%) */
<<if _npc.sectNPC is "Unaffiliated">>
<<set _newSect to ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect"].random()>>
<<set _npc.sectNPC to _newSect>>
<<set _npc.NPCrank to ["Disciple", "Member"].random()>>
<<set _text to `${_npc.fullname} has officially joined the ${_newSect}! Their future now lies with a major power.`>>
<<else>>
<<set _text to `Word is ${_npc.fullname} discovered an ancient ruin and emerged with valuable treasures.`>>
<</if>>
<<case 50 to 61>> /* Seclusion training (12%) */
<<set _npc.NPCinsight to _npc.NPCinsight + random(2,6)>>
<<set _npc.NPCbasewillpower to _npc.NPCbasewillpower + random(1,4)>>
<<set _text to `It is said ${_npc.fullname} has entered closed-door cultivation for months. Their foundation grows deeper...`>>
<<case 62 to 71>> /* Dual cultivation scandal / Charm increase (10%) */
<<set _npc.charm to _npc.charm + random(5,12)>>
<<set _npc.depravity to _npc.depravity + random(3,10)>>
<<set _text to `Taverns buzz with scandalous tales of ${_npc.fullname}'s passionate dual cultivation with a mysterious partner. Their charm has become almost bewitching.`>>
<<case 72 to 81>> /* Found treasure / Luck boost (10%) */
<<set _npc.NPCluck to _npc.NPCluck + random(3,8)>>
<<set _text to `Fortune smiles on ${_npc.fullname} — they discovered a hidden spirit herb garden deep in the mountains!`>>
<<case 82 to 91>> /* Injured in battle (10%) */
<<set _npc.NPCcurrenthealth to Math.max(1, _npc.NPCcurrenthealth - random(10,30))>>
<<set _text to `Grave news: ${_npc.fullname} was severely wounded in a fierce battle against a rival. They are recovering slowly...`>>
<<case 92 to 94>> /* Moved to new location (3%) */
<<set _oldLoc to _npc.NPClocation>>
<<set _newLoc to ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _npc.NPClocation to _newLoc>>
<<set _text to `${_npc.fullname} has been spotted travelling towards ${_newLoc}. Perhaps they seek new opportunities there.`>>
<<case 95 to 97>> /* Memory of the dead (3%) */
<<if _npc.isDead>>
<<if _npc.killedByPlayer>>
<<if _npc.killedInRevenge>>
<<set _text to `Elderly cultivators sigh, remembering ${_npc.fullname} – a soul consumed by vengeance. "They died seeking justice... or perhaps madness."`>>
<<else>>
<<set _text to `Whispers speak of ${_npc.fullname}'s end at the hands of a mysterious cultivator. "Their killer walks free," they mutter.`>>
<</if>>
<<else>>
<<set _text to `Elderly cultivators sigh, remembering ${_npc.fullname}'s legendary sword technique. "If only they had lived longer..."`>>
<</if>>
<<else>>
<<set _text to `A wandering poet sings of ${_npc.fullname}'s deeds, comparing them to the immortals of old.`>>
<</if>>
<<case 98 to 99>> /* Rumours of revenge (2%) */
<<if $activeGrudges and $activeGrudges.length gt 0>>
<<set _randomGrudge to $activeGrudges.random()>>
<<set _text to `Whispers carry dark tidings: ${_randomGrudge.avengerName} hunts for the one who wronged ${_randomGrudge.victimName}. Vengeance is coming.`>>
<</if>>
<<default>> /* Pure flavor (10%) */
<<set _genderTerm to (_npc.gender is "female" ? "beauty" : "handsomeness")>>
<<set _flavors to [
`${_npc.fullname} was seen drinking alone under the moon in ${_npc.NPClocation}, lost in thought.`,
`Poets compose verses about ${_npc.fullname}'s peerless sword intent that split a waterfall in twain.`,
`Children in ${_npc.NPClocation} tell stories of how ${_npc.fullname} once flew across the sky on a sword of light.`,
`Old cultivators argue whether ${_npc.fullname}'s ${_genderTerm} comes from their cultivation or natural gift.`,
`A mysterious jade slip mentions ${_npc.fullname} will play a crucial role in the upcoming sect tournament.`,
`Merchants report seeing ${_npc.fullname} purchasing rare ingredients for a mysterious pill recipe.`
]>>
<<set _text to _flavors.random()>>
<</switch>>
<<if _text neq "">>
<div class="rumour-event">
<strong>◎ Rumour from the Jianghu ◎</strong><br>
<<print _text>>
</div>
<</if>>
<</if>>
<</if>>
<</widget>><!-- Arrogant Young Master Widgets -->
<<widget "set_aym_doggy_desc">>
<<set _random_desc_1 = $vagDoggyArrogantYMdesc.pluck()>>
<<set _random_desc_2 = $vagDoggyArrogantYMdesc.pluck()>>
<<set _random_desc_3 = $vagDoggyArrogantYMdesc.pluck()>>
<<set $vagDoggyArrogantYMdesc = [
"He fucks you hard - hands gripping your hips, teeth at your neck, hips slamming into you with practiced cruelty. Every thrust is punctuated by some mocking praise.",
"His cock drives deep from behind, your ass slapping against his hips with every punishing thrust. He uses you like a toy, panting with pleasure as he dominates you.",
"You feel completely exposed as he takes you from behind, one hand on your neck and the other spanking your ass between thrusts. There's no gentleness - just raw, possessive force.",
"He grabs your hair and pulls you back as he thrusts deeper. Your cries only make him grin harder - you’re being claimed, over and over again.",
"Bent over with your face pressed to the bedding, you can only moan as he ruts into you like a beast in heat. He fucks like he owns you, and in this moment, maybe he does."
]>>
<</widget>>
<<widget "set_aym_doggy_talk">>
<<set _random_talk_1 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_2 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_3 = $vagArrogantYMtalks.pluck()>>
<<set $vagArrogantYMtalks = [
"You moan like a whore.",
"Maybe I’ll keep you here. You’d look perfect leashed beneath my desk.",
"I knew you’d be good on all fours.",
"You're dripping like a bitch in heat. Don't pretend you're not loving this.",
"Say thank you, slut - thank me for fucking you.",
"No one's going to fuck you like this again. I ruin everything I use.",
"You're not even trying to resist anymore. Good. Know your place.",
"Do you like being used by someone above your station?"
]>>
<</widget>>
<<widget "set_aym_cowgirl_desc">>
<<set _random_desc_1 = $vagCowgirlArrogantYMdesc.pluck()>>
<<set _random_desc_2 = $vagCowgirlArrogantYMdesc.pluck()>>
<<set _random_desc_3 = $vagCowgirlArrogantYMdesc.pluck()>>
<<set $vagCowgirlArrogantYMdesc = [
"He pulls you into his lap, your back to his chest, and forces you down onto his cock, letting you ride him like a toy built for his pleasure.",
"His hand cracks down on your ass, sharp and loud, leaving a red mark that stings with each bounce.",
"You feel his cock throb deep inside as he guides your hips, fucking you from beneath while you moan helplessly."
]>>
<</widget>>
<<widget "set_aym_cowgirl_talk">>
<<set _random_talk_1 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_2 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_3 = $vagArrogantYMtalks.pluck()>>
<<set $vagArrogantYMtalks = [
"Louder. I want everyone outside to hear what a good whore you are.",
"You ride like you've done this before - don't lie to me.",
"That ass will carry my handprint for days. Perfect.",
"I could sit here all night and let you fuck yourself stupid on my cock."
]>>
<</widget>>
<<widget "set_aym_proneboneANAL_desc">>
<<set _random_desc_1 = $analProneArrogantYMdesc.pluck()>>
<<set _random_desc_2 = $analProneArrogantYMdesc.pluck()>>
<<set _random_desc_3 = $analProneArrogantYMdesc.pluck()>>
<<set $analProneArrogantYMdesc = [
"He shoves your face down into the cushion, lifting your hips and exposing your hole before pushing inside slowly, stretching you open inch by inch.",
"Each thrust is hard and deep, his hips smacking against your ass while your moans are muffled in the fabric beneath you.",
"He leans over your back, breathing hotly into your ear as he pounds into your ass like he owns it."
]>>
<</widget>>
<<widget "set_aym_proneboneANAL_talk">>
<<set _random_talk_1 = $analArrogantYMtalks.pluck()>>
<<set _random_talk_2 = $analArrogantYMtalks.pluck()>>
<<set _random_talk_3 = $analArrogantYMtalks.pluck()>>
<<set $analArrogantYMtalks = [
"Face down, ass up - just how I like my pets.",
"You’ll feel this every time you sit, and you’ll remember who did it to you.",
"Even your tight little hole can't resist me.",
"You're nothing but a hole for my pleasure now. Accept it."
]>>
<</widget>>
<<widget "AymFinisher">>
<<set _roll to random(1,3)>>
<<if _roll eq 1>>
<img src="images/Sex/vagCreampie.webp" class="nsfw-glow">>
<<set _finisher_desc_1 = $vagArrogantYMcumCreampie.pluck()>>
<<set $vagArrogantYMcumCreampie = [
"With a final, brutal thrust, he buries himself deep - your walls clamp around him just as hot spurts of cum flood your pussy. He grunts, grinding in to make sure it all stays inside.",
"He slams in and holds you tight, cock twitching as he fills you. Warm, thick seed spills deep, and he sighs in satisfaction like he just claimed a prize.",
"You feel his cock throb deep inside, and then the hot rush of release. His cum leaks from you almost instantly, but he stays buried, as if daring it to escape.",
"His rhythm falters, then stops - and he groans low as he spills into you. You can feel every pulse, every drop marking you from the inside.",
"He fucks you straight through his climax, pumping cum into you with each lingering thrust. It’s messy, filthy, and he clearly loves it that way."
]>>
<<set _finisher_talk_1 = $vagArrogantYMcumTalkCreampie.pluck()>>
<<set $vagArrogantYMcumTalkCreampie = [
"That's where you belong - dripping full of me.",
"Hope you weren’t planning on using that hole for anyone else.",
"Mmm. You feel better wrapped around my cock than anyone else has.",
"I’ll leave it in for a while - wouldn’t want it leaking out too soon.",
"Consider yourself claimed. You’ll be smelling like me for days."
]>>
<<elseif _roll eq 2>>
<img src="images/Sex/swallow.webp" class="nsfw-glow">>
<<set _finisher_desc_1 = $ArrogantYMcumMouth.pluck()>>
<<set $ArrogantYMcumMouth = [
"He shoves your head down, groaning as he cums. Hot, bitter seed hits the back of your throat in thick spurts, and he doesn’t let you up until you’ve swallowed every drop.",
"His cock pulses against your tongue as he fills your mouth. You can’t help but gag slightly, but he just grins and tells you to keep going - to take it all.",
"He moans low and steady, holding your head tight as he cums directly into your mouth. You’re left with no choice but to swallow or choke.",
"Warm cum floods your mouth as he finishes, and you can taste every humiliating drop. He pulls out slow and wipes the tip against your lips.",
"He cums hard, and you feel it fill your mouth almost instantly. It drips down your chin as he laughs and wipes the excess across your cheek."
]>>
<<set _finisher_talk_1 = $vagArrogantYMcumTalkMouth.pluck()>>
<<set $vagArrogantYMcumTalkMouth = [
"Swallow it all. Don’t waste a drop.",
"Good whore. Maybe I’ll let you taste it again sometime.",
"You make a decent cumdump, I’ll give you that.",
"Open wider next time. I want to see it pool on your tongue.",
"Keep your mouth open. I’m not done using it."
]>>
<<elseif _roll eq 3>>
<<set _random0 = random(0,1)>>
<<if _random0 eq 0>>
<img src="images/Sex/facial.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/facial1.webp" class="nsfw-glow"><</if>>
<<set _finisher_desc_1 = $ArrogantYMcumFace.pluck()>>
<<set $ArrogantYMcumFace = [
"He jerks himself fast, then tilts your chin up - hot ropes of cum splash across your cheeks, lips, and nose. You feel it drip as he smirks.",
"With a low grunt, he strokes out thick spurts that land across your face - some hitting your forehead, others your lips. You’re painted in disgrace.",
"His cock twitches in his grip, then he releases - warm cum hitting your face in wet splashes, some getting in your hair. He looks proud of the mess.",
"You close your eyes just in time. Cum streaks across your face, running down your jaw and onto your collarbone. He chuckles and calls it an improvement.",
"He holds your face steady, aiming every pulse of cum directly onto your features. You're left dripping, sticky, and humiliated - just how he likes it."
]>>
<<set _finisher_talk_1 = $vagArrogantYMcumTalkFace.pluck()>>
<<set $vagArrogantYMcumTalkFace = [
"Now that’s a good look for you. So fucking pretty like this.",
"Smile for me. Let everyone see how I decorated you.",
"Stay still. I want to admire my work.",
"That’s what your face is good for - catching my cum.",
"Wipe it off? No. Walk around like that. Let them know."
]>>
<</if>>
<</widget>>
<<widget "AymTavernImg">>
<<if _position eq "doggy">>
<<set _random0 to random(0,1)>>
<<if _random0 eq 0>>
<img src="images/Sex/doggy.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/doggy1.webp" class="nsfw-glow"><</if>>
<<elseif _position eq "cowgirl">>
<<set _random0 to random(0,2)>>
<<if _random0 eq 0>>
<img src="images/Sex/revcow.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/revcow2.webp" class="nsfw-glow"><<elseif _random0 eq 2>>
<img src="images/Sex/revcow3.webp" class="nsfw-glow"><</if>>
<</if>>
<<if _penetration eq "anal">>
<<set _random0 to random(0,4)>>
<<if _random0 eq 0>>
<img src="images/Sex/pb.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/pb1.webp" class="nsfw-glow"><<elseif _random0 eq 2>>
<img src="images/Sex/pb2.webp" class="nsfw-glow"><<elseif _random0 eq 3>>
<img src="images/Sex/pb3.webp" class="nsfw-glow"><<elseif _random0 eq 4>>
<img src="images/Sex/pb4.webp" class="nsfw-glow"><</if>>
<</if>>
<</widget>>
<!-- End of Arrogant Young Master Widgets --><<widget "SexDescription">>
<<set _img to $args[0]>>
<<set _partner to $args[1]>>
<<set _dominance to $args[2] ?? "neutral">>
<<set _gender to $args[3] ?? "male">>
<<set _d to "">>
/* ===================== START / FOREPLAY ===================== */
<<if ["foreplay1","foreplay2","kissing1","undressing",
"f_foreplay1","f_foreplay2","f_kissing1","f_undressing"].includes(_img)>>
<<if _dominance === "dom">>
<<if _gender === "female">>
<<set _d to "You shove " + _partner + " against the wall, taking what you want. Your hands roam her soft curves, commanding her responses as you grind your hips against hers, feeling her wetness soak through her robes.">>
<<else>>
<<set _d to "You shove " + _partner + " against the wall, taking what you want. Your hands roam his body, commanding his responses as you rub your core against his hardening length.">>
<</if>>
<<else>>
<<if _gender === "female">>
<<set _d to either(
_partner + " slams you against the wall, her hands pinning your wrists. She doesn't bother with your robes, instead sliding her hands inside the fabric to mash and squeeze your breasts. You can feel her thigh pressing aggressively between your legs, rubbing exactly where you ache the most.",
"She pulls you onto her lap, her fingers digging into the meat of your thighs. Her hands wander greedily under your layers, mapping the curve of your ass. Every time you shift, you feel her grinding her soaked core against yours, the friction through the silk layers making the ache in your pussy more demanding."
)>>
<<else>>
<<set _d to either(
_partner + " slams you against the wall, his heavy palms pinning your wrists while his knee shoves between your thighs to force them apart. He doesn't bother with your robes, instead sliding his rough hands inside the fabric to mash and squeeze your breasts until your nipples are bruised and hard. You can feel the thick, rigid length of his cock rubbing against your hip.",
"He pulls you onto his lap, his fingers digging into the meat of your thighs with enough force to leave marks. His hands wander greedily under your layers. Every time you shift, you feel his massive erection grinding against your entrance."
)>>
<</if>>
<</if>>
/* ===================== TEASING ===================== */
<<elseif ["teasing","f_teasing"].includes(_img)>>
<<if _gender === "female">>
<<set _d to "She slides a finger along the slit of your pussy, coating it in your own thick juices but refusing to push inside. She watches your hips jerk with a predatory smirk, enjoying the way your muscles twitch. She continues to circle your sensitive nub, applying just enough pressure to keep you on the edge without giving you the release you're begging for.">>
<<else>>
<<set _d to "He slides a finger along the slit of your pussy, coating it in your own thick juices but refusing to push inside. He watches your hips jerk and your back arch with a predatory smirk, enjoying the way your muscles twitch in a desperate attempt to pull him in.">>
<</if>>
/* ===================== NECK / KISSING ===================== */
<<elseif ["kissing_neck","neck_kiss","f_kissing_neck","f_neck_kiss"].includes(_img)>>
<<if _gender === "female">>
<<set _d to "She buries her face in the crook of your neck, sucking the skin so hard you can feel the capillaries bursting. She uses her teeth to nip at your throat, leaving dark, jagged marks. Her hands are busy mauling your waist, pulling you tightly against her soft, heated body.">>
<<else>>
<<set _d to "He buries his face in the crook of your neck, sucking the skin so hard you can feel the capillaries bursting under his tongue. He uses his teeth to nip and tear at your throat, leaving dark, jagged marks that will last for days.">>
<</if>>
/* ===================== KISSING (deep) ===================== */
<<elseif ["kissing_deep","kissing_intense","kissing_bite",
"f_kissing_deep","f_kissing_intense","f_kissing_bite"].includes(_img)>>
<<if _gender === "female">>
<<set _d to "Her mouth crashes against yours, her tongue pushing past your lips with a hunger that leaves you breathless. She bites your lower lip hard enough to sting, then soothes it with a slow, deliberate kiss.">>
<<else>>
<<set _d to "His mouth is bruising and demanding, his tongue forcing its way past yours. He swallows every sound you make, one hand fisted in your hair to keep you exactly where he wants you.">>
<</if>>
/* ===================== ORAL – GIVE (male partner) ===================== */
<<elseif ["blowjob1","blowjob2","blowjob_deep","kneeling_oral"].includes(_img)>>
<<set _d to either(
"You sink to your knees and wrap your lips around his thick, pulsing shaft, sliding down until your nose is buried in his pubic hair. You use your hands to stroke the base of his cock while your mouth works the top, your saliva slicking the entire length.",
"Your mouth is stretched to its limit as you take the full circumference of " + _partner + "'s cock. You bob your head in a steady, rhythmic pace, the wet slapping sound of your lips hitting his thighs filling the silence."
)>>
/* ===================== ORAL – GIVE (female partner) ===================== */
<<elseif ["f_cunnilingus_give1","f_cunnilingus_give2","f_licking1","f_kneeling_oral_give"].includes(_img)>>
<<set _d to "You part her thighs and bury your face between them. Your tongue relentlessly laps at her dripping slit, circling her swollen clit until her hips thrash against your mouth. She tangles her fingers in your hair, trying to push you deeper as she whimpers your name.">>
/* ===================== ORAL – RECEIVE ===================== */
<<elseif ["cunnilingus1","cunnilingus2","facesitting_light"].includes(_img)>>
<<set _d to _partner + " buries his face between your spread thighs. His tongue is merciless, lapping up your juices and flicking across your clit with expert, rapid strokes. Your back arches as you grab the sheets, completely at his mercy.">>
<<elseif ["f_cunnilingus_receive1","f_cunnilingus_receive2","f_facesitting1"].includes(_img)>>
<<set _d to _partner + " buries her face between your spread thighs. Her tongue is merciless, lapping up your juices and flicking across your clit with expert, rapid strokes. Your back arches as you grab the sheets, completely at her mercy.">>
/* ===================== HAND / MUTUAL ===================== */
<<elseif ["handjob1","handjob2","mutual_touch","hand_stroke"].includes(_img)>>
<<set _d to "His rough hand wraps around your wrist and guides your fingers to his throbbing length, showing you exactly how he wants it. You stroke him in slow, twisting pulls while he works two fingers knuckle-deep into your slick heat, curling them forward until you gasp.">>
<<elseif ["f_handjob1","f_mutual_touch","f_fingering_standing","f_hand_tease"].includes(_img)>>
<<set _d to "Her fingers find the slick heat between your thighs with practiced ease, working a slow, deliberate rhythm that makes your knees threaten to buckle. You press your hand against her in turn, feeling how wet she already is as you match her pace stroke for stroke.">>
/* ===================== VAGINAL – MALE ===================== */
<<elseif ["missionary","missionary2","missionary3","missionary_intense",
"cowgirl1","cowgirl_grind","doggy1","doggy",
"standingsex","standingsex1"].includes(_img)>>
<<if _dominance === "dom">>
<<set _d to "You straddle him, taking him inside you on your own terms. You set the agonizingly slow pace, making him beg before you finally slam down, seating him to the hilt.">>
<<else>>
<<set _d to either(
_partner + " pins your legs back against your chest and drives into you with a heavy, meat-on-meat thud. Each stroke is a violent intrusion, his thick shaft stretching your pussy to its absolute limit before pulling out almost entirely and slamming back in.",
"He buries his cock into you with one long, agonizingly deep lunge that hits your cervix, making your vision blur. He doesn't slow down, instead building a frantic rhythm that has your bodies sliding against each other in a mess of sweat and juices."
)>>
<</if>>
/* ===================== VAGINAL – FEMALE ===================== */
<<elseif ["f_fingering_deep1","f_fingering_deep2"].includes(_img)>>
<<set _d to _partner + " drives her fingers into you with ruthless precision, curling them forward to drag across that deep, sensitive spot. Her palm grinds against your clit with every thrust, forcing you to ride her hand as the pleasure builds to an almost unbearable pitch.">>
<<elseif ["f_tribbing1","f_tribbing2","f_scissoring1"].includes(_img)>>
<<set _d to "You and " + _partner + " lock your legs together, your swollen, dripping pussies pressed tightly against one another. Every time you grind your hips, the slick friction sends pure fire through your nerves. The sound of wet flesh meeting echoes in the room as you both chase your climax.">>
<<elseif ["f_strapon1","f_strapon2"].includes(_img)>>
<<set _d to _partner + " straps on a thick, rigid toy and drives it relentlessly into your dripping core. It lacks the warmth of flesh, but the brutal, unyielding hardness of it stretches you to the absolute limit as she pounds you into the bedding, matching a man's ferocity.">>
/* ===================== ANAL – MALE ===================== */
<<elseif ["anal1","anal_doggy","anal_standing"].includes(_img)>>
<<set _d to either(
_partner + " ignores your initial gasps of pain and shoves his thick head into your tight rear. He doesn't wait for you to adjust, instead forcing his way in inch by inch until he is buried to the hilt.",
"The sensation of being filled in your ass is absolute. " + _partner + " drives into your rear with a heavy, rhythmic pressure that makes your entire body shake."
)>>
/* ===================== ANAL – FEMALE ===================== */
<<elseif ["f_anal_fingering1","f_anal_fingering2"].includes(_img)>>
<<set _d to _partner + " works a slick finger slowly into your rear entrance, watching your face intently as she stretches you open. A second finger joins the first and she begins to thrust in a slow, deliberate rhythm, the deep fullness making you whimper into the sheets.">>
<<elseif ["f_strapon_anal1","f_strapon_anal2"].includes(_img)>>
<<set _d to _partner + " forces her way into your tight, forbidden entrance with the rigid toy. The stretch is agonizingly sharp before melting into a deep, throbbing fullness as she ruthlessly works your backdoor, her hips snapping forward with a ferocity that makes you cry out.">>
/* ===================== CLIMAX – MALE ===================== */
<<elseif ["creampie1","creampie2","missionary_creampie"].includes(_img)>>
<<set _d to either(
_partner + " jerks violently as he reaches his limit, slamming his cock into you as deep as it can go and holding it there. You feel the first hot jet of his seed hit your cervix, followed by pulse after pulse of thick, viscous fluid.",
"He lets out a guttural roar and shoves himself into you one last time, pinning you down as his cock twitches and sprays his hot release deep inside your core."
)>>
/* ===================== CLIMAX – FEMALE ===================== */
<<elseif ["f_mutual_climax1","f_mutual_climax2",
"f_climax_player1","f_climax_player2",
"f_climax_npc1","f_climax_npc2"].includes(_img)>>
<<set _d to "A high, broken wail escapes her lips as the climax shatters her control. Her body spasms violently against yours, her thighs clamping tight as she rides out every wave, completely spent and gasping for breath.">>
/* ===================== CLIMAX – MALE SHARED ===================== */
<<elseif ["mutual_climax1","mutual_climax2",
"climax_player1","climax_player2"].includes(_img)>>
<<set _d to "Your body seizes and arches, a broken cry tearing from your throat as the climax crashes through you. Every muscle locks tight before dissolving into shuddering, helpless tremors.">>
/* ===================== OTHER ===================== */
<<elseif ["cum_in_mouth1","swallow"].includes(_img)>>
<<set _d to "He rips his cock out of your pussy and shoves it into your mouth just as he starts to blow. Thick, hot ropes of cum hit the back of your throat, forcing you to swallow rhythmically to avoid choking.">>
<<elseif ["cum_on_chest1","cum_on_belly1"].includes(_img)>>
<<set _d to "He jerks himself off over your body. Thick, white ropes of cum splatter across your skin, landing with a wet sound and sticking to you instantly.">>
<</if>>
<<if _d neq "">>
<br><span class="sex-desc"><<print _d>></span>
<</if>>
<</widget>><<widget "Penetration_roll">>
<<set _roll to random(0,100)>>
<<if _roll lte 15>>
<<set _penetration to "anal">>
He's going for your ass!
<<else>>
<<set _penetration to "vaginal">>
He's going for your pussy.
<</if>>
<</widget>>
<!-- Universal Repeatable NSFW Scene Widget -->
<!--======================================== -->
<!--======================================== -->
<!--======================================== -->
<!--======================================== -->
<<widget "FinishScene">>
<<set _partner = $args[0]>>
<<set _sceneType = $args[1]>>
<<set _climaxType = $args[2] ?? "none">>
<<set _return = $args[3] ?? $passage>>
/* Scene‑type specific stat changes & logging */
<<if _sceneType eq "forced_npc">>
<<set $corruption = Math.min(100, $corruption + 10)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 15)>>
<<set _partner.depravity += 2>>
<<LogEvent "sex" "Spirit Shattered" `"Your dignity was trampled by " + _partner.fullname + " in a brutal encounter that stained your path to immortality."` 4 _partner.id _partner.fullname>>
<<elseif _sceneType eq "aggressive_player">>
<<set $corruption = Math.min(100, $corruption + 8)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 10)>>
<<set _partner.depravity += 3>>
<<LogEvent "sex" "Dominant Will" `"You imposed your will upon " + _partner.fullname + ", asserting your dominance in the realm of flesh."` 4 _partner.id _partner.fullname>>
<<elseif _sceneType eq "rape_player">>
<<set $corruption = Math.min(100, $corruption + 15)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 25)>>
<<set _partner.depravity += 5>>
<<LogEvent "sex" "Demonic Violation" `"A dark act committed against " + _partner.fullname + ", leaving their spirit broken and your own heart colder."` 5 _partner.id _partner.fullname>>
<<elseif _sceneType eq "consensual_flirt">>
<<set $corruption = Math.min(100, $corruption + 3)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 8)>>
<<set _partner.depravity += 1>>
<<LogEvent "sex" "Fated Entwinement" `"A night of shared breath and flowing Qi with " + _partner.fullname + " has strengthened your worldly bonds."` 2 _partner.id _partner.fullname>>
<<elseif _sceneType eq "consensual_seduce">>
<<set $corruption = Math.min(100, $corruption + 5)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 12)>>
<<set _partner.depravity += 2>>
<<LogEvent "sex" "Captivating the Spirit" `"Through charms and intent, you drew " + _partner.fullname + " into a night of profound dual pleasure."` 3 _partner.id _partner.fullname>>
<<elseif _sceneType eq "revenge_victory">>
<<set $corruption = Math.min(100, $corruption + 10)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 20)>>
<<set _partner.depravity += 8>>
<<set $sexFame += 5>>
<<LogEvent "sex" "Vanquished Pride" `"Having defeated " + _partner.fullname + " in combat, you claimed their dignity as your trophy."` 5 _partner.id _partner.fullname>>
<<elseif _sceneType eq "revenge_loss">>
<<set $corruption = Math.min(100, $corruption + 8)>>
<<set $sexFame += 5>>
<<LogEvent "sex" "Humbled by the Victor" `"Defeat led to deep humiliation; you were forced to submit to " + _partner.fullname + "'s vengeful desires."` 5 _partner.id _partner.fullname>>
<<elseif _sceneType eq "merchant">>
/* Generic merchant transaction – effects vary by reason string */
<<if $reason eq "blessing">>
<<set $corruption = Math.min(100, $corruption + random(2,4))>>
<<set $sexFame += 2>>
<<set $gold += 50>> /* the promised pill's value */
<<LogEvent "sex" "Merchant's Blessing" "You performed a 'blessing' for a merchant." 3>>
<<elseif $reason eq "tribute">>
<<set $corruption = Math.min(100, $corruption + random(3,5))>>
<<set $sexFame += 3>>
<<set $demonicreputation += 2>>
<<LogEvent "sex" "Demanded Tribute" "You forced a terrified merchant to service you sexually as tribute." 4>>
<<elseif $reason eq "aphrodisiacs">>
<<set $corruption = Math.min(100, $corruption + random(5,8))>>
<<set $sexFame += 4>>
<<set $gold += random(80,150)>>
<<LogEvent "sex" "Forbidden Transaction" "You accepted a merchant's lewd offer for a night of pleasure." 3>>
<<else>>
<<set $corruption = Math.min(100, $corruption + random(2,5))>>
<<set $sexFame += 2>>
<<LogEvent "sex" "Merchant Encounter" "You shared an intimate moment with a wandering merchant." 2>>
<</if>>
<<elseif _sceneType eq "brothel_hire">>
/* Hiring a courtesan */
<<set $corruption = Math.min(100, $corruption + random(2,4))>>
<<set $sexFame += 2>>
<<set $health = Math.min($maxhealth, $health + random(0,15))>> /* Optional pleasure boost */
<<LogEvent "sex" "Brothel Visit" `"You spent a night with " + _partner.fullname + " at the Crimson Blossom."` 2>>
<<elseif _sceneType eq "brothel_work">>
<<set $corruption = Math.min(100, $corruption + random(3,6))>>
<<set $sexFame += 4>>
<<set $gold += random(80, 200)>>
<<LogEvent "sex" "Brothel Work" "You worked a night at the Crimson Blossom, earning spirit stones." 3>>
<<elseif _sceneType eq "mission_sex">>
/* Generic mission sex handler – uses $currentMissionEffects */
<<MissionFinishAuto>>
<<if $currentMissionEffects>>
<<set $corruption = Math.min(100, $corruption + $currentMissionEffects.corruption)>>
<<set $sexFame += $currentMissionEffects.sexFame>>
<<if $currentMissionEffects.righteousreputation != 0>>
<<set $righteousreputation = Math.max(0, $righteousreputation + $currentMissionEffects.righteousreputation)>>
<</if>>
<<unset $currentMissionEffects>>
<<unset $missionDominance>>
/* Complete the mission (assumes MissionFinish widget exists) */
<</if>>
<</if>>
/* Climax‑type bonuses (only apply if partner is a real NPC with stats) */
<<if _partner and _partner.friendship is not undefined>>
<<if _climaxType eq "mutual">>
<<set $corruption = Math.min(100, $corruption + 1)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 2)>>
<<elseif _climaxType eq "player_first">>
<<set $corruption = Math.min(100, $corruption + 2)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 1)>>
<<elseif _climaxType eq "npc_first">>
<<set $corruption = Math.min(100, $corruption + 1)>>
<<set _partner.depravity += 2>>
<<elseif _climaxType eq "forced_by_player">>
<<set $corruption = Math.min(100, $corruption + 5)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 5)>>
<</if>>
<</if>>
<<if _partner and _partner.friendship is not undefined>>
/* Update the NPC in the known list */
<<set _index = $known_npc_list.findIndex(function(n) { return n.id === _partner.id; })>>
<<if _index >= 0>>
<<set $known_npc_list[_index] = _partner>>
<</if>>
<</if>>
/* Always add general sex fame (small) */
<<set $sexFame += random(1,2)>>
/* Clean up temporary variables used for the sex scene */
<<unset $sexPartner>>
<<unset $sexType>>
<<unset $sexReturnPassage>>
<<unset $reason>>
<<unset $missionDominance>>
<<unset $currentMissionEffects>>
<<goto _return>>
<</widget>>
<<widget "CasualSex">>
<<set _partnerArg to $args[0] ?? "your partner">>
<<set _reason to $args[1] ?? "for pleasure">>
<<set _dominance to $args[2] ?? "neutral">>
<<set _mode to $args[3] ?? "full">>
<<set _return to $args[4] ?? $passage>>
<<set _scene = $args[5] ?? null>>
<<set _originalType = $args[6] ?? "casual">>
<<set _isNPC = (_partnerArg and _partnerArg.fullname and _partnerArg.gender)>>
<<if not _scene or typeof _scene !== "object">>
<<set _scene = {
position: "start",
playerArousal: 0,
npcArousal: 0,
finished: false,
playerClimaxed: false,
npcClimaxed: false,
partner: _isNPC ? _partnerArg : null,
partnerName: _isNPC ? _partnerArg.fullname : _partnerArg,
partnerGender: _isNPC ? _partnerArg.gender : "male",
originalType: _originalType
}>>
<</if>>
<<set _arousalGains = {
"start": {player: 5, npc: 5},
"kissing": {player: 8, npc: 8},
"oral-give": {player: 6, npc: 12},
"oral-receive": {player: 12, npc: 6},
"hand": {player: 7, npc: 7},
"vaginal": {player: 15, npc: 12},
"anal": {player: 18, npc: 10}
}>>
<<set _partnerName = _scene.partnerName>>
<<set _partnerGender = _scene.partnerGender>>
<<set _pSubj = _partnerGender === "male" ? "he" : "she">>
<<set _pObj = _partnerGender === "male" ? "him" : "her">>
<<set _pPos = _partnerGender === "male" ? "his" : "her">>
<<set _pRefl = _partnerGender === "male" ? "himself" : "herself">>
<<set _partnerLinesMale = ["Good girl...", "Take it all", "You're so tight", "Just like that", "Beg for it", "You feel amazing", "I'm close...", "Swallow it all", "Hold still", "So wet for me", "That's it...", "You love this", "Deeper?", "You're perfect", "Such a good slut"]>>
<<set _partnerLinesFemale = ["Good boy...", "Take it all", "You're so hard", "Just like that", "Beg for it", "You feel amazing", "I'm close...", "Swallow it all", "Hold still", "So hard for me", "That's it...", "You love this", "Deeper?", "You're perfect", "Such a good slut"]>>
<<set _partnerLines = _partnerGender === "male" ? _partnerLinesMale : _partnerLinesFemale>>
<<if $corruption gte 70>>
<<set _playerMoans to $playerSexLinesCorrupt>>
<<elseif $corruption gte 30>>
<<set _playerMoans to $playerSexLinesNormal>>
<<else>>
<<set _playerMoans to $playerSexLinesPure>>
<</if>>
<div id="casualSexContainer">
<<if _scene.position === "start">>
<br><br>
<<if _dominance === "dom">>
<<if _partnerGender === "male">>
You press <<print _partnerName>> against the wall, taking full control. <span class="player">"You're going to make this worth my time."</span>
<<else>>
You push <<print _partnerName>> onto the bed, straddling her with a hungry grin. <span class="player">"You're mine tonight."</span>
<</if>>
<<elseif _dominance === "sub">>
<<if _partnerGender === "male">>
<<print _partnerName>> grabs your hips firmly and pushes you down. <span class="partner-male">"You'll earn every drop of that reward."</span>
<<else>>
<<print _partnerName>> pulls you close by the collar, her eyes dark with intent. <span class="partner-female">"Be a good girl and do as I say."</span>
<</if>>
<<else>>
<<if _partnerGender === "male">>
You both crash together, robes tearing in frantic need - no words, just raw hunger.
<<else>>
You tumble together onto the sheets, lips and hands everywhere at once, neither of you willing to slow down.
<</if>>
<</if>>
<</if>>
<div id="sexDisplay">
<<set _img = "">>
/* ===================== START ===================== */
<<if _scene.position === "start">>
<<if _partnerGender === "male">>
<<set _img to ["foreplay1","foreplay2","kissing1","teasing","undressing"].random()>>
Robes fall to the ground in a hurried pile. Hands roam greedily over bare skin, pulling you close as your lips meet in a heated kiss.
<<else>>
<<set _img to ["f_foreplay1","f_foreplay2","f_kissing1","f_teasing","f_undressing"].random()>>
Her hands slip beneath your clothes with practiced ease. You pull her against you, mouths meeting in a slow, deep kiss that quickly turns urgent.
<</if>>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<</if>>
/* ===================== KISSING ===================== */
<<if _scene.position === "kissing">>
<<if _partnerGender === "male">>
<<set _img to ["kissing_deep","kissing_intense","kissing_bite","neck_kiss"].random()>>
Your mouths fuse together in a fierce battle of tongues.
<<else>>
<<set _img to ["f_kissing_deep","f_kissing_intense","f_kissing_bite","f_neck_kiss"].random()>>
She cups your face and kisses you deeply, her tongue sliding against yours in a slow, deliberate dance.
<</if>>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<</if>>
/* ===================== ORAL - GIVE ===================== */
<<if _scene.position === "oral-give">>
<<if _partnerGender === "male">>
<<set _img to ["blowjob1","blowjob2","blowjob_deep","kneeling_oral"].random()>>
You sink to your knees, looking up at <<print _partnerName>>. You take <<print _pPos>> hard length into your mouth. Your tongue swirls slowly at first, then faster, drawing groans from <<print _pObj>>.
<<else>>
<<set _img to ["f_cunnilingus_give1","f_cunnilingus_give2","f_licking1","f_kneeling_oral_give"].random()>>
You press <<print _partnerName>> back and bury your face between her thighs. Your tongue parts her folds eagerly, tracing slow circles around her clit until her hips roll against your mouth.
<</if>>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<</if>>
/* ===================== ORAL - RECEIVE ===================== */
<<if _scene.position === "oral-receive">>
<<if _partnerGender === "male">>
<<set _img to ["cunnilingus1","cunnilingus2","facesitting_light"].random()>>
Your thighs are spread wide, <<print _pPos>> face buried between them. <<print _pSubj>> tongue dances over your sensitive folds, teasing and sucking with expert precision.
<<else>>
<<set _img to ["f_cunnilingus_receive1","f_cunnilingus_receive2","f_facesitting1"].random()>>
<<print _partnerName>> dips her head between your legs, her tongue working your most sensitive spot with practiced patience. You grip the sheets as she pulls you apart piece by piece.
<</if>>
<<set _moan1 to _playerMoans.random()>>
<<set _moan2 to _playerMoans.random()>><br><span class="player">"<<print _moan1>> <<print _moan2>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<</if>>
/* ===================== HAND ===================== */
<<if _scene.position === "hand">>
<<if _partnerGender === "male">>
<<set _img to ["handjob1","handjob2","mutual_touch","hand_stroke"].random()>>
Hands wrap around each other, stroking and teasing slick, heated flesh. Fingers slide and pump in perfect rhythm, building tension with every touch.
<<else>>
<<set _img to ["f_handjob1","f_mutual_touch","f_fingering_standing","f_hand_tease"].random()>>
Her fingers find their way between your legs, stroking and teasing with confident precision while your own hand presses against her warmth. You work each other in breathless rhythm.
<</if>>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<</if>>
/* ===================== VAGINAL ===================== */
<<if _scene.position === "vaginal" and ["full","vaginal"].includes(_mode)>>
<<if _partnerGender === "male">>
<<set _img to ["missionary","missionary2","missionary3","cowgirl1","doggy1","doggy","standingsex","standingsex1","missionary_intense","cowgirl_grind"].random()>>
<<print _partnerName>> slides deep into your dripping pussy with powerful thrusts. Each stroke fills you completely, hitting every sensitive spot as the pace turns frantic.
<<else>>
<<set _img to ["f_fingering_deep1","f_fingering_deep2","f_tribbing1","f_tribbing2","f_scissoring1","f_strapon1","f_strapon2"].random()>>
<<print _partnerName>> presses deep into you - fingers curling, hips rolling - filling you with relentless rhythm. Her free hand grips your thigh as she drives you closer to the edge.
<</if>>
<<set _moan1 to _playerMoans.random()>>
<<set _moan2 to _playerMoans.random()>><br><span class="player">"<<print _moan1>> <<print _moan2>> Yes-!"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<</if>>
/* ===================== ANAL ===================== */
<<if _scene.position === "anal" and ["full","anal"].includes(_mode)>>
<<if _partnerGender === "male">>
<<set _img to ["anal1","anal_doggy","anal_standing"].random()>>
<<print _partnerName>> slowly presses into your tight rear entrance. The stretch is intense, overwhelming - <<print _pSubj>> gives you a moment, then begins thrusting deeper and harder.
<<else>>
<<set _img to ["f_anal_fingering1","f_anal_fingering2","f_strapon_anal1","f_strapon_anal2"].random()>>
<<print _partnerName>> works a slick finger slowly into your rear entrance, watching your face as she stretches you. A second finger joins the first, and she begins to thrust in a slow, deliberate rhythm that leaves you breathless.
<</if>>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>> It's too much... ahh!"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<</if>>
<<if _img !== "">>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
<<SexDescription _img _partnerName _dominance _partnerGender>>
<</if>>
</div>
<<if not _scene.finished>>
<div class="arousal-info" style="font-size:0.8em; opacity:0.7;">
Your arousal: <<print _scene.playerArousal>> / <<print $maxArousal>><br>
<<print _partnerName>>'s arousal: <<print _scene.npcArousal>> / <<print $maxArousal>>
</div>
<<set _climaxReady = (_scene.playerArousal >= $maxArousal or _scene.npcArousal >= $maxArousal)>>
<<if not _climaxReady>>
<p><strong>Continue...</strong></p>
<ul>
<<if _scene.position !== "">>
<li><<linkreplace "Continue in this position">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains[_newScene.position].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains[_newScene.position].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["foreplay","full"].includes(_mode) and _scene.position !== "kissing">>
<li><<linkreplace "Passionate kissing">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "kissing">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["kissing"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["kissing"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["oral","full"].includes(_mode)>>
<<if _scene.position !== "oral-give">>
<li><<linkreplace "Give oral">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "oral-give">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["oral-give"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["oral-give"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if _scene.position !== "oral-receive">>
<li><<linkreplace "Receive oral">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "oral-receive">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["oral-receive"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["oral-receive"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<</if>>
<<if ["hand","full"].includes(_mode) and _scene.position !== "hand">>
<li><<linkreplace "Manual play">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "hand">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["hand"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["hand"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["vaginal","full"].includes(_mode) and _scene.position !== "vaginal">>
<<set _vaginalLabel = _partnerGender === "male" ? "Vaginal penetration" : "Finger her / Trib">>
<li><<linkreplace _vaginalLabel>>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "vaginal">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["vaginal"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["vaginal"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["anal","full"].includes(_mode) and _scene.position !== "anal">>
<<set _analLabel = _partnerGender === "male" ? "Anal penetration" : "Anal fingering">>
<li><<linkreplace _analLabel>>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "anal">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["anal"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["anal"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
</ul>
<<else>>
<<set _playerClimaxed = (_scene.playerArousal >= $maxArousal)>>
<<set _npcClimaxed = (_scene.npcArousal >= $maxArousal)>>
<<if _playerClimaxed and _npcClimaxed>>
<<set _climaxType = "mutual">>
<<elseif _playerClimaxed>>
<<set _climaxType = "player">>
<<else>>
<<set _climaxType = "npc">>
<</if>>
<div id="climax-options">
<<if _climaxType === "mutual">>
<<linkreplace "Climax together">>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<if _partnerGender === "male">>
<<set _img to ["mutual_climax1","mutual_climax2"].random()>>
<<else>>
<<set _img to ["f_mutual_climax1","f_mutual_climax2"].random()>>
<</if>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
You both lose control at the same moment - bodies locked, trembling in shared ecstasy as waves of pleasure crash through you.
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<br><br>Breathless and spent, the deal is sealed.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "mutual" _return>><</link>>
<</replace>>
<</linkreplace>>
<<elseif _climaxType === "player">>
<<linkreplace "Climax on your own">>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<if _partnerGender === "male">>
<<set _img to ["climax_player1","climax_player2"].random()>>
<<else>>
<<set _img to ["f_climax_player1","f_climax_player2"].random()>>
<</if>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
Your body arches, a cry escaping your lips as you reach your peak alone.
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<br><br>You collapse, sated.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "player_first" _return>><</link>>
<</replace>>
<</linkreplace>>
<<else>>
<<if _dominance === "dom">>
<<set _forcedLabel = _partnerGender === "male" ? "Force them to finish inside" : "Make her finish">>
<<linkreplace _forcedLabel>>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<if _partnerGender === "male">>
<<set _img to ["creampie1","creampie2","missionary_creampie"].random()>>
<<print _partnerName>> groans and you force <<print _pObj>> deep, feeling <<print _pPos>> pulse as <<print _pSubj>> fills you.
<<else>>
<<set _img to ["f_climax_npc1","f_climax_npc2"].random()>>
You press <<print _partnerName>> over the edge, her whole body shuddering as she comes undone beneath your hands.
<</if>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
<<SexDescription _img _partnerName _dominance _partnerGender>>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<br><br>You've claimed <<print _pObj>>.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "forced_by_player" _return>><</link>>
<</replace>>
<</linkreplace>>
<<else>>
<<set _letFinishLabel = _partnerGender === "male" ? "Let them finish" : "Let her finish">>
<<linkreplace _letFinishLabel>>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<if _partnerGender === "male">>
<<set _img to ["creampie1","creampie2","missionary_creampie"].random()>>
<<print _partnerName>> releases inside you, <<print _pPos>> warmth spreading.
<<else>>
<<set _img to ["f_climax_npc1","f_climax_npc2"].random()>>
<<print _partnerName>> shudders against you, a soft cry on her lips as she crests and falls, clinging to you through every wave.
<</if>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
<<SexDescription _img _partnerName _dominance _partnerGender>>
<<set _moan to _playerMoans.random()>><br><span class="player">"<<print _moan>>"</span>
<<set _line to _partnerLines.random()>><br><span class="partner-<<print _partnerGender>>">"<<print _line>>"</span>
<br><br>It's over.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "npc_first" _return>><</link>>
<</replace>>
<</linkreplace>>
<</if>>
<</if>>
</div>
<</if>>
<</if>>
<<if _scene.position === "vaginal" and $virginity == 1 and _partnerGender === "male">>
<<set $virginity to 0>>
<<set $virginityLost to _partnerName>>
<span class="red">You lost your virginity to <<print _partnerName>>!</span><br>
<</if>>
<<if _scene.position === "anal" and $analVirginity == 1 and _partnerGender === "male">>
<<set $analVirginity to 0>>
<<set $analVirginityLost to _partnerName>>
<span class="red">You lost your anal virginity to <<print _partnerName>>!</span><br>
<</if>>
</div>
<</widget>><div class="xianxia-wide-container">
<!-- Center Column: Full Body Form -->
<div class="xianxia-col portrait-panel">
<div class="main-portrait-wrapper">
<img src="images/Character/hf1.png" alt="Full Body Form">
</div>
<div class="xianxia-workspace">
<!-- Left Column: Multi-stage Closeups -->
<div class="xianxia-col closeups-panel">
<div class="panel-title">Vessel Closeups</div>
<div class="closeup-grid">
<!-- Breasts: Stage 1 & 2 -->
<div class="closeup-box">
<div class="stage-label">Stage 1</div>
<img src="images/Character/hb1.png" alt="Breasts Stage 1">
<div class="closeup-desc">Soft and supple</div>
</div>
<!-- Mouth: Stage 1 & 2 -->
<div class="closeup-box">
<div class="stage-label">Stage 1</div>
<img src="images/Character/hm1.png" alt="Mouth Stage 1">
<div class="closeup-desc">Pouty and defiant</div>
</div>
<!-- Vagina: Stage 1 & 2 -->
<div class="closeup-box">
<div class="stage-label">Stage 1</div>
<img src="images/Character/hp1.png" alt="Vagina Stage 1">
<div class="closeup-desc">Sealed and pristine</div>
</div>
<!-- Buttocks: Stage 1 & 2 -->
<div class="closeup-box">
<div class="stage-label">Stage 1</div>
<img src="images/Character/ha1.png" alt="Buttocks Stage 1">
<div class="closeup-desc">Firm and alluring</div>
</div>
</div>
</div>
<!-- Right Column: Descriptions & Carnal Records -->
<div class="xianxia-col data-panel">
<div class="description-block">
<div class="desc-line"><strong>Mouth:</strong> <span>Enticing and full of promise</span></div>
<div class="desc-line"><strong>Breasts:</strong> <span>Fat tits jiggle with every step you take, demanding attention with their soft warmth.</span></div>
<div class="desc-line"><strong>Vagina:</strong> <span>Unmarred and pristine, tightly sealed.</span></div>
<div class="desc-line"><strong>Buttocks:</strong> <span>Full and enticing, drawing illicit gazes with each movement.</span></div>
</div>
<div class="horizontal-divider"></div>
<div class="panel-title">Records</div>
<table class="stats-table">
<b>Corruption</b>: $corruption
<tr>
<td>Human Encounters:</td>
<td><<print $humanSexCount || 0>></td>
<td>Seductions:</td>
<td><<print $seductions || 0>></td>
</tr>
<tr>
<td>Monster Encounters:</td>
<td><<print $monsterSexCount || 0>></td>
<td>Pushed Down:</td>
<td><<print $pushedDown || 0>></td>
</tr>
<tr>
<td>Sexually Harassed:</td>
<td><<print $harassedCount || 0>></td>
<td>Oral Acts:</td>
<td><<print $oralCount || 0>></td>
</tr>
<tr>
<td>Toys Used:</td>
<td><<print $toysUsed || 0>></td>
<td>Anal Acts:</td>
<td><<print $analCount || 0>></td>
</tr>
<tr>
<td>Primal Yin Seal:</td>
<td colspan="3">
<<if $virginity eq 1>>
<span class="status-pristine">Intact (Pure Lotus)</span>
<<else>>
<span class="status-broken">Shattered by <<print $virginityLost>></span>
<</if>>
</td>
</tr>
</table>
<div class="xianxia-action-row">
<<link "Roll Up the Scroll" "Status" >><</link>>
</div>
</div>
</div>
</div><<widget "MerchantTroupeWidget">>
<!-- ─────────────────────── pe 0 · Merchant Encounter ─────────────────────── -->
<<if $pe eq 0>>
<<nobr>>
/* ── Cache guard: skip re-roll if returning from a sub-view ── */
<<if $merchantReactionCached is undefined>>
<<set _fames to [
{type:"righteous", val:$totalPCrighteousreputation, min:40},
{type:"demonic", val:$totalPCdemonicreputation, min:40},
{type:"sex", val:$sexFame, min:25},
{type:"general", val:$totalFame, min:0 },
]>>
<<set _eligible to _fames.filter(function(f){ return f.val >= f.min; })>>
<<set _eligible to _eligible.sort(function(a,b){ return b.val - a.val; })>>
<<set _top1 to _eligible.length > 0 ? _eligible[0] : {type:"none",val:0}>>
<<set _top2 to _eligible.length > 1 ? _eligible[1] : {type:"none",val:0}>>
<<set _primary to _top1.val > 0 ? _top1.type : "none">>
<<set _secondary to _top2.val > 0 ? _top2.type : "none">>
<<set _merchantsReaction to "normal">>
<<switch _primary>>
<<case "righteous">> <<set _merchantsReaction to "reverent">>
<<case "demonic">> <<set _merchantsReaction to "fearful">>
<<case "sex">> <<set _merchantsReaction to "lustful">>
<<case "general">> <<set _merchantsReaction to "respectful">>
<</switch>>
/* Cache all randomly-determined values for this encounter */
<<set $merchantReactionCached to _merchantsReaction>>
<<set $merchantSecondaryCached to _secondary>>
<<set $merchantRollCached to random(1,100)>>
<<set $merchantGenderCached to either("son","daughter")>>
<<else>>
/* Restore from cache when returning from shop/rumors */
<<set _merchantsReaction to $merchantReactionCached>>
<<set _secondary to $merchantSecondaryCached>>
<</if>>
/* ════════════════ ARRIVAL FLAVOUR ════════════════ */
<<switch _merchantsReaction>>
<<case "reverent">>
<p>The merchants notice you immediately. Several bow deeply, eyes wide with recognition and respect.</p>
<p><i><<print either("\"An Elder of great virtue!\"", "\"A righteous cultivator walks among us!\"", "\"The heavens have sent a paragon!\"")>></i></p>
<<if _secondary is "sex">>
<p>…yet quite a few gazes linger with poorly concealed hunger. Even paragons, it seems, inspire earthly thoughts.</p>
<<elseif _secondary is "demonic">>
<p>…though an unsettling shadow clings to your aura. They bow regardless. Fear and reverence are not so different in practice.</p>
<<elseif _secondary is "combat">>
<p>The reverence is tinged with healthy wariness of your battle prowess.</p>
<</if>>
<<case "fearful">>
<p>The moment you approach, merchants pale and step back. Whispers spread like spilled oil:</p>
<p><i><<print either("\"It's the Blood Demon!\"", "\"The one who left the valley in corpses!\"", "\"Don't look her in the eye!\"", "\"They say she devoured an elder's golden core whole!\"")>></i></p>
<<if _secondary is "sex">>
<p>Still… some stares betray a dangerous, forbidden attraction. The devil's beauty, they whisper.</p>
<<elseif _secondary is "righteous">>
<p>A few seem torn between terror and inexplicable awe — the righteous thread still in you makes the darkness somehow worse.</p>
<</if>>
<p>One brave — or foolish — merchant steps forward, hands visibly trembling.</p>
<<case "lustful">>
<p>More than a few merchants stare openly, eyes lingering far too long. Smirks and knowing glances pass between them like a shared secret.</p>
<<if _secondary is "demonic">>
<p>The desire is mixed with genuine fear — a very dangerous combination in men like these.</p>
<<elseif _secondary is "combat">>
<p>They lust… but the memory of your reputation keeps their hands exactly where they belong. For now.</p>
<<elseif _secondary is "righteous">>
<p>The hunger mingles with grudging reverence. They want you, and they feel guilty about it, which only makes it worse.</p>
<</if>>
<p>One particularly bold trader approaches with a slow, lazy smile.</p>
<<case "respectful">>
<p>Word of your deeds has reached even these wandering traders. They treat you with cautious respect — slight bows, lowered voices, smiles that reach their eyes.</p>
<<default>>
<p>The merchants greet you with practiced ease — another cultivator, another potential customer. Business is business.</p>
<<if $sexFame gte 30>>
<p>One of the younger apprentices, however, can't stop sneaking glances at you. He flushes scarlet every time your eyes meet.</p>
<</if>>
<</switch>>
/* ════════════════ INTERACTIONS ════════════════ */
<!---------------------------- REVERENT ---------------------------->
<<if _merchantsReaction is "reverent">>
<p><span class="merchant">"Honored cultivator!"</span> the senior merchant calls, bowing until his forehead nearly grazes the dirt. <span class="merchant">"Please — grace our humble caravan. We offer our finest wares, and whatever else might please you."</span></p>
<br><<link "Browse their wares">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Visit the back room">><<set $pe to 4>><<goto "NormalEvents">><</link>>
<br><<link "Ask for rumors and information">><<set $pe to 5>><<goto "NormalEvents">><</link>>
/* ── Blessing request: gender cached, group option at high corruption ── */
<<if $merchantRollCached lte 40>>
<<if $merchantGenderCached is "son">>
<p>The merchant's son steps forward, blushing to his ears. <span class="male1">"Great Immortal… my father humbly asks if you would consider a Dual Cultivation blessing for our family line. A Jade Soul Pill, as dowry. No expectations beyond what you are comfortable with."</span></p>
<<else>>
<p>A young woman emerges from behind the largest wagon — the merchant's daughter, clearly nervous. <span class="female1">"Honored one… my father believes a cultivator of your virtue could strengthen our family's bloodline. Would you consent to a rite of Dual Cultivation? We have prepared a Jade Soul Pill."</span></p>
<</if>>
<<if $corruption gt 20>>
<br><<link "Give the blessing ♡">>
<<set $sexPartner to "the merchant's " + $merchantGenderCached>>
<<set $sexType to "merchant">>
<<set $reason to "blessing">>
<<set $dominance to "neutral">>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<br><i>No… I couldn't do something like that.</i>
<</if>>
<<if $corruption gte 50>>
<p>Several other young merchants edge forward, eyes hopeful. One clears his throat: <span class="male1">"Would the honored one consider… a broader blessing? For the whole family's prosperity?"</span></p>
<br><<link "Bless the whole retinue ♡">>
<<set $sexPartner to "the merchant family">>
<<set $sexType to "merchantgroup">>
<<set $reason to "group blessing">>
<<set $dominance to "dom">>
<<goto "EncounterInteractionSex">>
<</link>>
<</if>>
<</if>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<!---------------------------- FEARFUL ---------------------------->
<<elseif _merchantsReaction is "fearful">>
<p>The senior merchant swallows visibly. <span class="merchant">"W-we have no quarrel with you, exalted one. Please… take whatever you wish. Just… spare us."</span></p>
<div id="choice">
<br><<link "Browse their wares">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Ask for rumors and information">><<set $pe to 5>><<goto "NormalEvents">><</link>>
<br><<linkreplace "Demand tribute">>
<<replace "#choice">>
<<set _angerRoll to random(1,100)>>
<<if _angerRoll lte 30>>
<p>The merchants panic — several draw hidden weapons, courage born of desperation.</p>
<<ScaredMerchants>>
<<BeforeBattle>>
<br><<link "To battle!" "Battle1">>
<<set $passage to "Battle1">>
<<set $nextPe to 10>>
<</link>>
<<else>>
<p><span class="player">"Protection isn't free. Your finest herbs — now — or I consider a different form of payment."</span></p>
<p>They empty their best crates without another word.</p>
<br><<startStatChanges>>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 3 0 999 "Demonic Reputation">>
<br><<showStatChanges>>
<p>You leave with considerably more than expected.</p>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<</if>>
<</replace>>
<</linkreplace>>
/* ── Let them appease you: lower bar, they come to you ── */
<<if $corruption gte 25>>
<br><<link "Let them appease you ♡">>
<<set $pe to 2>>
<<set $sexPartner to "the trembling merchant">>
<<set $sexType to "merchant">>
<<set $reason to "appeasement">>
<<set $dominance to "dom">>
<<goto "EncounterInteractionSex">>
<</link>>
<</if>>
/* ── Demand favour: higher bar / dao-imprint gate ── */
<<if $activeDaoImprint.skillid eq "devouringessence" or $corruption gt 40>>
<br><<link "Demand a favour ♡">>
<<set $pe to 2>>
<<set $sexPartner to "merchant">>
<<set $sexType to "merchant">>
<<set $reason to "tribute">>
<<set $dominance to "dom">>
<<goto "EncounterInteractionSex">>
<</link>>
<</if>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
</div>
<!---------------------------- LUSTFUL ---------------------------->
<<elseif _merchantsReaction is "lustful">>
<p>The merchant's gaze traces every line of you with barely concealed hunger. <span class="merchant">"Such a jade beauty… a few nights in my carriage and you'll leave with the finest pill in my stock. No one need know, little bird."</span></p>
<div id="choice">
/* ── Full encounter ── */
<<if $corruption gte 30>>
<br><<linkreplace "Accept the 'private transaction' ♡">>
<<replace "#choice">>
<p><span class="player">"A private transaction… I've heard worse proposals. Lead the way."</span></p>
<br><<linkreplace "Seal the arrangement ♡">>
<<replace "#choice">>
<<set $sexCumcount to 0>>
<<set $sexPosition to "">>
<<set $sexFinished to false>>
<<set $scene to 0>>
<<set $pe to 2>>
<div id="casualSexContainer">
<<CasualSex "the bold merchant" "special aphrodisiacs and spirit stones" "neutral" "full" "NormalEvents">>
</div>
<</replace>>
<</linkreplace>>
<</replace>>
<</linkreplace>>
<</if>>
/* ── Tease and deny: no scene, charisma reward ── */
<<if $corruption gte 15>>
<br><<linkreplace "Tease him, then walk away…">>
<<replace "#choice">>
<p>You let a slow smile cross your face and step closer — close enough that his breath catches. You trail a finger along the edge of his display table, hold his gaze exactly one beat too long, and then step away just as his hand twitches forward.</p>
<p><span class="player">"A lovely offer. I'll take your best spirit herb instead."</span></p>
<p>He's too flustered to form an argument. You pocket the herb and leave him standing there, red-faced and speechless.</p>
<br><<startStatChanges>>
<br><<gainStat "sexFame" "sexFame" 3 0 999 "Fame">>
<br><<set $gold to $gold + 20>>
<br><<showStatChanges>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<br><<link "Browse their wares after all">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<</replace>>
<</linkreplace>>
<</if>>
/* ── Name your own terms: dom, fame-gated ── */
<<if $corruption gte 20 and $sexFame gte 30>>
<br><<linkreplace "Name your own terms ♡">>
<<replace "#choice">>
<p>You let him finish his little speech. Then:</p>
<p><span class="player">"You've mistaken the situation, merchant. I'm not one of your customers. If I decide to grace you with my attention, it will be on my terms — and you will be grateful for the privilege."</span></p>
<p>His jaw goes slack. He nods immediately, almost reflexively, and you haven't even told him what the terms are yet.</p>
<<set $sexPartner to "the bold merchant">>
<<set $sexType to "merchant">>
<<set $reason to "dominance">>
<<set $dominance to "dom">>
<<goto "EncounterInteractionSex">>
<</replace>>
<</linkreplace>>
<</if>>
/* ── Decline ── */
<br><<linkreplace "Slap the suggestion away">>
<<replace "#choice">>
<p>You fix him with a look that could freeze a river mid-current.</p>
<p><span class="player">"Keep your filthy thoughts to yourself."</span></p>
<p><span class="merchant">"Of course, of course… forgive my boldness, great immortal."</span> He stumbles backward over his own feet.</p>
<br><<startStatChanges>>
<br><<set $sexFame to Math.max(0, $sexFame - 2)>>
<br><<gainStat "totalFame" "totalFame" 1 0 999 "Reputation">>
<br><<showStatChanges>>
<br><<link "Browse their wares">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<</replace>>
<</linkreplace>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
</div>
<!---------------------------- RESPECTFUL ---------------------------->
<<elseif _merchantsReaction is "respectful">>
<p><span class="merchant">"A cultivator of renown graces our humble caravan,"</span> the leader says with a genuine bow. <span class="merchant">"Please — allow us to show our appreciation. You will find our prices more flexible for someone of your standing."</span></p>
<br><<link "Browse their wares">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Ask for rumors and information">><<set $pe to 5>><<goto "NormalEvents">><</link>>
/* ── Shy apprentice proposition ── */
<<if $sexFame gte 20 and $corruption gte 20>>
<p>A young apprentice — barely more than a boy, though his qi is not insignificant — edges out from behind a crate, clutching his ledger with both hands.</p>
<p><span class="male1">"Honored… honored cultivator. I know this is deeply improper. But I've heard stories about you, and I — I would consider it the greatest honor of my cultivation if you would… if you might consider…"</span> He trails off, entirely crimson.</p>
<div id="apprentice">
<br><<linkreplace "Hear him out ♡">>
<<replace "#apprentice">>
<p>You tilt your head. He nearly faints.</p>
<<set $sexPartner to "the young apprentice">>
<<set $sexType to "merchant">>
<<set $reason to "honor">>
<<set $dominance to "dom">>
<<goto "EncounterInteractionSex">>
<</replace>>
<</linkreplace>>
<br><<linkreplace "Let him down gently">>
<<replace "#apprentice">>
<p>You give him a look that is not unkind.</p>
<p><span class="player">"Work harder at your cultivation. Come find me in ten years."</span></p>
<p>He looks like he might faint from equal parts shame and hope.</p>
<</replace>>
<</linkreplace>>
</div>
<</if>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<!---------------------------- NORMAL ---------------------------->
<<else>>
<p>The merchants greet you with practiced ease. <span class="merchant">"Welcome, traveler! Pills, talismans, spirit stones, rare ingredients — finest wares from the four directions. What catches your eye?"</span></p>
<br><<link "Browse their wares">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Ask for rumors and information">><<set $pe to 5>><<goto "NormalEvents">><</link>>
/* ── Starstruck young merchant: high sex fame only ── */
<<if $sexFame gte 30 and $corruption gte 20>>
<p>As you look over the nearest display, a younger merchant drifts close under the pretense of rearranging stock. <span class="male1">"You're… you're her, aren't you,"</span> he breathes. Not quite a question. <span class="male1">"The one the stories are about."</span></p>
<div id="youngmerchant">
<br><<linkreplace "\"And what have you heard?\"">>
<<replace "#youngmerchant">>
<p>He swallows hard. <span class="male1">"Enough to know that whatever you charge for your time… I have savings."</span></p>
<br><<linkreplace "Name a price ♡">>
<<replace "#youngmerchant">>
<<set $sexCumcount to 0>>
<<set $sexPosition to "">>
<<set $sexFinished to false>>
<<set $scene to 0>>
<<set $pe to 2>>
<div id="casualSexContainer">
<<CasualSex "the starstruck young merchant" "a handsome sum of spirit stones" "dom" "full" "NormalEvents">>
</div>
<</replace>>
<</linkreplace>>
<br><<linkreplace "Not interested">>
<<replace "#youngmerchant">>
<p>You return your attention to the wares without a word. He retreats to his post and doesn't look up again.</p>
<</replace>>
<</linkreplace>>
<</replace>>
<</linkreplace>>
</div>
<</if>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<</if>>
<</nobr>>
<!-- ─────────────────────── pe 10 · Post-Battle Loot ─────────────────────── -->
<<elseif $pe eq 10>>
<p>You emerge victorious. Some merchants have scattered into the treeline; others lie motionless across the road. You pick through the wreckage methodically before moving on.</p>
<br><<startStatChanges>>
<br><<set $gold += random(10,200)>>
<br><<gainStat "PCdemonicreputation" "PCdemonicreputation" 1 0 999 "Demonic Reputation">>
<br><<showStatChanges>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<!-- ─────────────────────── pe 2 · Browse Wares ─────────────────────── -->
<<elseif $pe eq 2>>
<<set _currentOfferings to $wanderingMerchantInventory.randomMany(4)>>
<div class="merchant-header"><h2>Wandering Merchant</h2></div>
<br><<link "↩ Return to merchant">><<set $pe to 0>><<goto "NormalEvents">><</link>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<p>Your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong></p>
<br><<link "Sell your own items" "NormalEvents">><<set $pe to 3>><</link>>
/* ── Body negotiation entry point ── */
<<if $corruption gte 25>>
<p><i>The merchants keep stealing glances. Perhaps there's another kind of trade to be made…</i></p>
<div id="bodneg">
<br><<linkreplace "💋 Negotiate a better rate…">>
<<replace "#bodneg">>
<p>You catch the lead merchant's eye and hold it exactly one beat too long. His breath stutters audibly.</p>
<p><span class="player">"I think we can come to a more… personal arrangement."</span></p>
<br><<linkreplace "Proceed ♡">>
<<replace "#bodneg">>
<<set $pe to 6>>
<<set $sexCumcount to 0>>
<<set $sexPosition to "">>
<<set $sexFinished to false>>
<<set $scene to 0>>
<div id="casualSexContainer">
<<CasualSex "the lead merchant" "a steep discount on all wares" "neutral" "full" "NormalEvents">>
</div>
<</replace>>
<</linkreplace>>
<br><<linkreplace "Actually, never mind">>
<<replace "#bodneg">>
<p>You think better of it and step back. The merchant exhales quietly, clearly unsure whether to be relieved or disappointed.</p>
<</replace>>
<</linkreplace>>
<</replace>>
<</linkreplace>>
</div>
<</if>>
<<if $purchase neq null>>
<p style="color:#4fc3f7; font-weight:bold; text-align:center;">You have acquired <<print $purchase>>.</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<table class="merchant-table">
<thead>
<tr>
<th>Offer</th>
<th style="width:150px;text-align:center;">Price</th>
<th style="width:100px;text-align:center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt _currentOfferings.length; _i++>>
<<set _item to _currentOfferings[_i]>>
<tr>
<td>
<div class="item-name"><<print _i+1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
</td>
<td style="text-align:center;vertical-align:middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align:center;vertical-align:middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough</span>
<<else>>
<<capture _item>>
<<link "Buy" "NormalEvents">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playeriteminventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<<set $pe to 2>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<!-- ─────────────────────── pe 3 · Sell Items ─────────────────────── -->
<<elseif $pe eq 3>>
<div class="merchant-header"><h2>Your Items</h2></div>
<br><<link "↩ Return to merchant">><<set $pe to 0>><<goto "NormalEvents">><</link>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<p>Your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong></p>
<br><<link "Browse the merchants' wares" "NormalEvents">><<set $pe to 2>><</link>>
<<if $purchase neq null>>
<p style="color:#4fc3f7; font-weight:bold; text-align:center;">You have sold <<print $purchase>>.</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<table class="merchant-table">
<thead>
<tr>
<th>Item</th>
<th style="width:150px;text-align:center;">Sell Price</th>
<th style="width:100px;text-align:center;">Sell</th>
</tr>
</thead>
<tbody>
<<set _hasItems to false>>
<<for _i to 0; _i lt $playeriteminventory.length; _i++>>
<<if $playeriteminventory[_i].quantity gt 0>>
<<set _hasItems to true>>
<<capture _i>>
<tr>
<td>
<div class="item-name"><<print _i+1>>. <<print $playeriteminventory[_i].name>></div>
<div class="item-desc"><<print $playeriteminventory[_i].description>></div>
<div class="item-desc">Qty: <<print $playeriteminventory[_i].quantity>></div>
</td>
<td style="text-align:center;vertical-align:middle;">
<div class="item-price"><<print $playeriteminventory[_i].sellprice>> Spirit Stones</div>
</td>
<td style="text-align:center;vertical-align:middle;">
<<link "Sell" "NormalEvents">>
<<set $gold += $playeriteminventory[_i].sellprice>>
<<set $purchase to $playeriteminventory[_i].name>>
<<set $purchaseclass to $playeriteminventory[_i].class>>
<<set $playeriteminventory[_i].quantity -= 1>>
<<set $pe to 3>>
<</link>>
</td>
</tr>
<</capture>>
<</if>>
<</for>>
<<if _hasItems is false>>
<tr>
<td colspan="3" style="text-align:center;"><i>Your satchel is empty.</i></td>
</tr>
<</if>>
</tbody>
</table>
<!-- ─────────────────────── pe 4 · Reverent Back Room ─────────────────────── -->
<<elseif $pe eq 4>>
<p>The senior merchant leads you through a heavy curtain into the private section of the largest wagon. The air smells of aged sandalwood and something faintly charged with spirit energy. Lacquered chests line every wall.</p>
<br><p><span class="merchant">"We don't show these to ordinary travelers,"</span> he murmurs, opening the nearest chest with reverent hands. <span class="merchant">"For someone of your virtue… consider this a gesture of devotion."</span></p>
<<if $purchase neq null>>
<p style="color:#4fc3f7; font-weight:bold; text-align:center;">You have acquired <<print $purchase>>.</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<<nobr>>
<<set _backRoomOfferings to []>>
<<for _raw range $wanderingMerchantInventory.randomMany(2)>>
<<set _disc to clone(_raw)>>
<<set _disc.price to Math.floor(_disc.price * 0.75)>>
<<set _backRoomOfferings.push(_disc)>>
<</for>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Rare Offer</th>
<th style="width:150px;text-align:center;">Price</th>
<th style="width:100px;text-align:center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt _backRoomOfferings.length; _i++>>
<<set _item to _backRoomOfferings[_i]>>
<tr>
<td>
<div class="item-name"><<print _i+1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
<div class="item-desc" style="color:#aed581;"><i>Offered at a reverent 25% discount.</i></div>
</td>
<td style="text-align:center;vertical-align:middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align:center;vertical-align:middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough</span>
<<else>>
<<capture _item>>
<<link "Buy" "NormalEvents">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playeriteminventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<<set $pe to 4>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<br><<link "↩ Return to merchant">><<set $pe to 0>><<goto "NormalEvents">><</link>>
<br><<link "Browse the main caravan">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<!-- ─────────────────────── pe 5 · Rumors & Information ─────────────────────── -->
<<elseif $pe eq 5>>
<<nobr>>
<<set _rumorPool to []>>
/* ── Base rumors: 2 drawn at random ── */
<<set _baseRumors to [
{tag:"⚔️ Conflict", text:"Two minor sects have been locked in open warfare near Ashbone Ravine for a month. Neither will yield. Neutral parties are strongly advised to take the long route around."},
{tag:"💰 Opportunity", text:"A spirit mine collapsed three days east, trapping low-rank disciples inside. The owning sect is offering open retrieval contracts — generous pay, no questions about methods."},
{tag:"🌿 Cultivation", text:"A wandering elder was spotted near the obsidian cliffs, trading fragments of lost scripture for five-century spirit herbs. Whether the texts are genuine is anyone's guess."},
{tag:"⚠️ Danger", text:"Three cultivators vanished in the mountain passes last month. Their storage rings turned up empty on the roadside. Whatever took them left no tracks, no witness, no body."},
{tag:"🏛️ Politics", text:"The Iron Gate Sect has been quietly purchasing border villages — paying fairly, for now. Locals are distinctly nervous about what comes after 'for now.'"},
{tag:"💰 Trade", text:"Demand for Cold-Sky Lotus has tripled since a plague swept through the northern city. Anyone sitting on stock could name nearly any price right now and find a buyer."},
{tag:"🌿 Resources", text:"Rumor places a small, unregistered spirit spring somewhere in the western hills. No sect has claimed it yet — either it hasn't been verified, or whoever found it is very quietly keeping quiet."},
{tag:"⚠️ Warning", text:"A self-styled toll has appeared on the Eastern Road, enforced by rogue cultivators calling themselves the Iron Vow Brotherhood. They haven't killed anyone yet. The 'yet' is doing a lot of work in that sentence."},
]>>
<<set _shuffled to _baseRumors.sort(function(){ return Math.random()-0.5; })>>
<<set _rumorPool to _rumorPool.concat(_shuffled.slice(0,2))>>
/* ── Fame-gated rumors ── */
<<if $totalPCrighteousreputation gte 40>>
<<set _rumorPool.push(either(
{tag:"🌟 About You", text:"The Jade Virtue Pavilion has been asking after you by name. Something urgent, requiring a cultivator of unimpeachable character — they've been tight-lipped about details, which means it's either dangerous or deeply embarrassing. Possibly both."},
{tag:"🌟 About You", text:"A small orphan sect in the eastern villages has built a roadside shrine with your likeness. The story of your deeds has grown considerably in the telling — apparently you also slew a divine beast and returned a stolen rain cloud."}
))>>
<</if>>
<<if $totalPCdemonicreputation gte 40>>
<<set _rumorPool.push(either(
{tag:"☠️ About You", text:"Three righteous sects have apparently pooled resources to place a bounty on someone matching your description exactly. The sum is significant enough that even some rogue cultivators are taking notice."},
{tag:"☠️ About You", text:"A demon lord in the southern wastes is said to have toasted your name at a banquet, calling you 'the kind of monster that even monsters respect.' Whether that's a compliment depends entirely on your perspective."}
))>>
<</if>>
<<if $sexFame gte 25>>
<<set _rumorPool.push(either(
{tag:"🌸 Whispers", text:"Several prominent young masters have reportedly made significant wagers regarding the possibility of gaining your personal attention. The amounts involved are frankly scandalous. At least two of them can't afford to lose."},
{tag:"🌸 Whispers", text:"Poems about a certain 'jade-faced cultivator of extraordinary gifts' have been circulating at teahouses along the main road. Your name isn't used, but anyone who has met you would recognize the subject immediately."},
{tag:"🌸 Whispers", text:"A pearl-ranked courtesan from the Crimson Lantern House resigned her position this season. Word is she crossed paths with you once and found all subsequent work uninspiring by comparison."}
))>>
<</if>>
<<if $totalFame gte 50>>
<<set _rumorPool.push({tag:"📣 Your Reputation", text:"Your name came up at a regional sect conclave last month. The reaction was divided — half the room went quiet, the other half began talking faster. Neither response is necessarily reassuring."})>>
<</if>>
<<set _displayRumors to _rumorPool.sort(function(){ return Math.random()-0.5; }).slice(0,4)>>
<</nobr>>
<div class="merchant-header"><h2>Rumors & Whispers</h2></div>
<p>The merchants lower their voices and lean in — people who trade in information as readily as goods.</p>
<<for _r range _displayRumors>>
<div class="rumor-card">
<span class="rumor-tag"><<print _r.tag>></span>
<p><<print _r.text>></p>
</div>
<</for>>
<br><<link "↩ Return to merchant">><<set $pe to 0>><<goto "NormalEvents">><</link>>
<br><<link "Browse their wares">><<set $pe to 2>><<goto "NormalEvents">><</link>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<!-- ─────────────────────── pe 6 · Negotiated Shop (40% off) ─────────────────────── -->
<<elseif $pe eq 6>>
<<set _negotiatedOfferings to $wanderingMerchantInventory.randomMany(4)>>
<div class="merchant-header"><h2>A Special Arrangement</h2></div>
<p>The merchant moves through his stock with renewed enthusiasm, pulling out items he'd been reserving for the right buyer. His apprentices have been sent well out of earshot.</p>
<br><p><span class="merchant">"Anything you want — forty percent off. Consider it a privilege to do business with you."</span></p>
<p>Your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong></p>
<<if $purchase neq null>>
<p style="color:#4fc3f7; font-weight:bold; text-align:center;">You have acquired <<print $purchase>>.</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<table class="merchant-table">
<thead>
<tr>
<th>Offer</th>
<th style="width:150px;text-align:center;">Price</th>
<th style="width:100px;text-align:center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt _negotiatedOfferings.length; _i++>>
<<set _item to clone(_negotiatedOfferings[_i])>>
<<set _item.price to Math.floor(_item.price * 0.6)>>
<tr>
<td>
<div class="item-name"><<print _i+1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
<div class="item-desc" style="color:#f48fb1;"><i>40% personal discount.</i></div>
</td>
<td style="text-align:center;vertical-align:middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align:center;vertical-align:middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough</span>
<<else>>
<<capture _item>>
<<link "Buy" "NormalEvents">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playeriteminventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<<set $pe to 6>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<br><<link "↩ Return to merchant">><<set $pe to 0>><<goto "NormalEvents">><</link>>
<br><<link "Continue with your journey" "Map|Region1">>
<<set $pe to 0>>
<<unset $merchantReactionCached $merchantSecondaryCached $merchantRollCached $merchantGenderCached>>
<</link>>
<</if>> /* end pe branches */
<</widget>><<widget "MortalRealm">>
<<if $playerX >= 6 && $playerX <= 9 && $playerY >= 6 && $playerY <= 8>> <<set $region to "Hundred Sorrows Mountain">> <p>You ascend the mist-shrouded slopes of <b>Hundred Sorrows Mountain</b>. The air grows heavy with resentment, and each breath tastes like regret. Twisted trees cling to black stone, and the wind carries faint, weeping cries that never seem to stop.</p>
<p>Legends say this place remembers every death that occurred here — and there were many. Vengeful spirits, corrupted beasts, and mad cultivators roam freely, drawn to the sorrowful qi that saturates the soil.</p>
<p>This cursed peak does not forgive mistakes. </p>
<<link "Start exploring" "Hundred Sorrows Mountain">><<set $passage to passage()>>
<<set $region to "Hundred Sorrows Mountain">>
<</link>>
<<elseif $playerX == 2 and $playerY == 12>>
<p>As you crest the final hill, the mist begins to part—revealing the modest yet vibrant town of <b>Jade Creek</b>. Wooden buildings with curved roofs nestle beside a flowing stream, and the faint scent of incense lingers in the air. It may not be a grand city, but it hums with quiet energy and the presence of cultivators.</p>
<<link "Enter town" "Jade Creek Town">>
<<set $region to "Jade Creek Town">>
<</link>>
<<elseif $playerX <= 2 and $playerX >= 1 and $playerY >= 5 and $playerY <= 6>>
<p>Before you stands the <b>Clear Sky Azure Dragon Pavilion</b>. Its high stone walls are etched with ancient calligraphy, and the pavilion’s blue-tiled roofs shimmer faintly under the sunlight, as if resonating with spiritual energy. Disciples in azure robes move with quiet discipline, their presence exuding a calm but formidable aura. This place is both sanctuary and stronghold—a beacon of order in a chaotic world.</p>
<<set $region to "Clear Sky Azure Dragon Pavilion">>
<<link "Enter sect" "ClearSkyAzureDragonPavilion">><</link>>
<<elseif $playerX eq 11 && $playerY eq 8>>
<p>As you approach the far edge of this realm, the world around you shifts. The winds still, the sky dims slightly — and before you stands a shimmering barrier of spiritual force, pulsing faintly like a living thing.</p>
<p>This is the <b>Boundary of Realms</b> — a powerful seal that separates the Lower Realms from what lies beyond: a vast and dangerous world where the true powers reside. It is said that the main branches of the great sects — those with influence stretching across generations — are located past this very barrier.</p>
<p>Beyond it roam cultivators of unimaginable strength, ancient beasts, and lands steeped in primordial energy. The difference in pressure alone makes your qi tremble in your dantian.</p>
<p>A weathered inscription glows softly on a nearby stone: <i>"Only those who have tempered their spirit and transcended the mortal coil may tread the path beyond."</i></p>
<p>For now, the barrier rejects your presence. Your journey in this realm is not yet finished.</p>
<<elseif $playerX >= 0 && $playerX <= 5 && $playerY >= 2 && $playerY <= 3>>
<p>You step into the arid expanse known as <b>Blood Sand Reach</b>. The scorching wind carries the scent of iron, and the sun beats down on dunes stained red — not by mineral, but by centuries of battle.</p>
<p>Whispers tell of rogue cultivators and desert beasts lurking beneath the sands, drawn to the qi of trespassers. This is no place for the unprepared — tread carefully, for death hides in the heat haze.</p><<set $region to "Blood Sand Reach">>
<<link "Start exploring" "Blood Sand Reach">><<set $region to "Blood Sand Reach">><</link>>
<<elseif $playerX >= 8 && $playerX <= 9 && $playerY >= 2 && $playerY <= 3>>
<p>Arriving at <strong>Northern Phoenix City</strong>, you are greeted by the rhythmic bustle of trade, the scent of incense, and the majestic outline of phoenix-shaped architecture glinting under the sky.</p>
<p>This northern stronghold is a center of commerce and cultivation alike — a meeting place of travelers, wandering cultivators, and the influential sects who hold sway in these lands.</p>
<<set $region to "Northern Phoenix City">>
<<elseif $playerX eq 3 and $playerY eq 9>>
You stumble upon the Lone Mountain.
Rising in solemn silence, this solitary mountain pierces the clouds — untouched, undisturbed. The wind here carries no whispers, only peace. As you step forward, you feel the weight of countless journeys that led you here.
<<link "Enter" "LonePeak">><</link>>
<<elseif $playerX >= 9 && $playerX <= 10 && $playerY >= 11 && $playerY <= 12>>
<p>You've reached the shadowed grounds of the <strong>Ghost King Netherworld Sect</strong> — a feared branch of an even more powerful sect residing deep within the Upper Realms.</p>
<p>The air here is cold and heavy, despite the lack of wind. Black banners flutter from bone-crafted spires, and pale disciples move silently like ghosts, their eyes empty of compassion.</p>
<<link "Enter sect" "GhostKingNetherworldSect">><</link>>
<<set $region to "Ghost King Netherworld Sect">>
<<elseif $playerX >= 4 && $playerX <= 8 && $playerY >= 4 && $playerY <= 8>>
<p>You find yourself within the vast <b>Great Plains</b>, a seemingly endless stretch of fertile grasslands where gentle winds ripple through fields of emerald green.</p>
<p>Though peaceful at first glance, these plains serve as a crossroads for wandering cultivators, spirit beasts, merchants, and hidden dangers. Ancient battlefields lie buried beneath the soil, and forgotten inheritances occasionally reveal themselves to the fortunate.</p>
<p>The land is rich in spiritual herbs, making it a favored destination for both adventurers and opportunists.</p>
<<set $region to "Great Plains">>
<<link "Start exploring" "Great Plains">><</link>>
<<else>>
<<set $region to "World Map">><<set $npcFinished>>
<</if>>
<</widget>>
<!--=================-
======================
=====================
=========================TOURNAMENT WIDGETS==========--><<widget "MainStorylineWidget">>
<<if $mainStageStarted eq "false">>
<<set _chance to random(0,100)>>
<<if _chance gt 50>>
As you move through the dense forest on the map, something unusual catches your eye. A faint glow pulses from behind a cluster of ancient rocks nearby.
Do you want to investigate?
<<link "Yes" "MainMissionStart">><<set $pe to 0>><</link>>
<</if>>
<</if>>
<<if $mainStageStarted eq "true" and $mainStage eq 0>>
<<set _chance to random(0,100)>>
<<if _chance gt 50>>
As you wander through region, you feel strange energy in the air, as if it were calling out to you...
Do you want to investigate?
<<link "Yes" "MainMissionStart">><<set $pe to 0>><</link>>
<</if>>
<</if>>
<</widget>><!--__________________________________________________________________________________________
_________________________ Patrol Perimeter Mission__________________________________________________________________________________________
_________________________ -->
<<widget "PatrolPerimeter01">>
<<if $pe eq 0>>
You arrive at the eastern gate just as dusk cloaks the sect in fading twilight. A pair of lanterns sway gently at the entrance, and a small patrol team awaits-swords at their hips, eyes sharp.<br>
<br>
You're assigned to a route along the outer spiritual barrier. It’s quiet… maybe too quiet.
<<CreateNPC001>><<set $juniorNPC to clone(_npc)>>
<<set _roll to random(1,5)>>
<<if _roll gte 2>>
As you near a bend in the forest path, something catches your eye. You notice fresh claw marks gouged into a tree trunk near the barrier. Whatever made them had strength - and didn’t belong near the sect.<br>
<<if _npc.gender eq "female">><span class="female">“Senior Sister… are those demonic beast marks?”</span> the _npc.fullname asks, glancing around nervously.<<else>><span class="male1">“Senior Sister… are those demonic beast marks?”</span> the _npc.fullname asks, glancing around nervously.<</if>><br>
You can choose to:<br>
You kneel and inspect the grooves. They're fresh-no older than a few hours. Blood specks darken the roots nearby.
<div id="choice">
<br><<link "Track the marks deeper into the woods">>
<<replace "#choice">>
You and your partner draw your weapons and begin following the faint trail of blood. The forest grows darker, qi in the air distorted.<br>
<br>
Suddenly, a low growl echoes ahead. A <b>Shadowtail Beast</b> emerges-sleek, dark-furred, its eyes glowing violet.
<<ShadowtailBeast>>
<br><<link "To battle!" "MissionBattle1">><<set $passage to "MissionBattle1">><<set $returnpassage to "MissionWidgets">><<set $pe to 0>><<BeforeBattle>><<set $nextPe to 4>><</link>>
<</replace>>
<</link>>
<br><<link "Return and report">>
<<replace "#choice">>
You mark the tree with a talisman and hurry back to report.<br>
The sect elders nod approvingly.<br>
<span class="male1">“Good instincts. Better to alert us than to act blindly.”</span>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Set up an ambush">>
<<replace "#choice">>
You and your junior lie in wait near the tree, using a minor qi concealment technique. Hours pass. Finally, the beast returns - sniffing near the blood trail.<br>
With perfect timing, you and the junior leap from the shadows and strike.
<<MissionFinish>>
<</replace>>
<</link>>
</div>
<<elseif $pe eq 1>>
xianxia
<<else>>
One of the junior disciples paired with you is a known flirt. As you patrol the bamboo-lined path,<<if _npc.gender eq "female">>she<<else>>he<</if>> walks a little too close, brushing against your shoulder now and then.<br>
<<if _npc.gender eq "female">><span class="female">“Cold night, isn’t it?” she says, voice low. <span class="female">“We could... keep each other warm while we watch the perimeter. I wouldn’t mind sharing body heat with a senior like you…”</span><<else>><span class="male1">“Cold night, isn’t it?” he says, voice low. <span class="male1">“We could... keep each other warm while we watch the perimeter. I wouldn’t mind sharing body heat with a senior like you…”</span><</if>>
<div id="choice">
<<if $corruption gt 25>><br><<link "Playfully flirt back">>
<<replace "#choice">>
<span class="player">“Only if you’re brave enough to keep up with a senior sister…”</span><br>
He laughs softly, the sound warm and confident.<br>
<span class="male1">“I like my odds. I’m good with my hands, after all-whether sword or… other tools.”</span><br>
You pause beside a tree, half-obscured by tall reeds. The sect is far behind, the perimeter ward humming faintly in the distance. No one else is around.<br>
His hand brushes your waist lightly-waiting for you to stop him. When you don’t, his fingers slide more boldly, slipping beneath the edge of your outer robe.<br>
<span class="male1">“May I?”</span> he whispers.<br>
You lean back against the tree and give him a subtle nod.<br>
He presses close, hands wandering over your body with growing confidence. His palm cups your breast through your robes, thumb flicking your nipple until it hardens beneath the fabric.<br>
<span class="male1">“So soft… Cultivation hasn’t hardened everything, huh?”</span><br>
His body stays close, heat pressing against you as one hand caresses the side of your thigh, slipping higher-so close, yet not quite where you ache. His fingers toy with the edge of your undergarments, knuckles grazing tender flesh without fully touching - close enough to tease, not enough to satisfy.<br>
<span class="male1">“You're already warm here,”</span> he murmurs, lips grazing your ear. <span class="male1">“Is this from the walk… or from me?”</span><br>
His fingertips finally brush your slit, slow and featherlight, just enough to make your hips twitch. He chuckles at your reaction, teasing you through the thin fabric with maddening patience.
<<set _img to ["juniorTease","juniorTease1"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" width=600>
<<if $juniorNPC.internalTrait eq "Wicked" or $juniorNPC.internalTrait eq "Evil">>
He pauses, letting his hand linger just shy of your clit.<br>
<span class="male1">“Mmm. You want it, don’t you?”</span> His voice is almost cruel in its amusement. <span class="male1">“Say it. Beg a little for your junior’s touch.”</span>
<br><<link "Whimper and beg him" $missionpassage>><<set $pe to 1>><</link>>
<br><<link "Smirk and grab his wrist" $missionpassage>><<set $pe to 2>><</link>>
<<else>>
He strokes you again, this time a little firmer, lips brushing your neck as he mutters, <span class="male1">“So sensitive… I wonder how much more you’ll take before you </span><br><<link "lose control." $missionpassage>><<set $pe to 3>><</link>>”
<</if>>
<</replace>>
<</link>><</if>>
<br><<link "Shut him down with icy elegance">>
<<replace "#choice">>
He backs off but watches you all patrol longingly.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Ignore him">>
<<replace "#choice">>
He keeps up the act but grows more cautious.
<<MissionFinish>>
<</replace>>
<</link>>
</div>
<</if>>
<<elseif $pe eq 1>>
<<PatrolPerimeter01Submissive>>
<<elseif $pe eq 2>>
<<PatrolPerimeter01Dominant>>
<<elseif $pe eq 3>>
<<PatrolPerimeter01Neutral>>
<<elseif $pe eq 4>>
After killing Shadowtail Beast and returning to the sect, you’re commended for your vigilance.
<<set $passage to "Map|Region1">>
<<MissionFinish>>
<</if>>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
CLEAN COURTYARD MISSION - EXPANDED
════════════════════════════════════════════════════════════════ -->
<<widget "CleanCourtyard01">>
<<CreateNPC001>>
You arrive at the old courtyard as morning light filters through ancient stone archways. Dust rises in clouds as you begin sweeping, the scent of wet moss clinging to the air.
<<set _chance = random(1,100)>>
<<if $CurrentPcSectRank eq "Initiate">>
You notice another disciple watching from nearby. Their expression shifts based on their nature.
<div id="courtyard-choice">
<<if _npc.internalTrait eq "Kind">>
<<if _npc.gender eq "male">>
<span class="male1">"New here?"</span> he asks warmly. <span class="male1">"If you need help with those weeds, just say so."</span>
<<else>>
<span class="female">"New here?"</span> she asks warmly. <span class="female">"If you need help with those weeds, just say so."</span>
<</if>>
<br><<link "Accept the help gracefully">>
<<replace "#courtyard-choice">>
You work together, and the task becomes pleasant rather than tedious. He shares sect gossip and advice.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 180>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Insist on doing it yourself">>
<<replace "#courtyard-choice">>
You politely refuse. He shrugs and leaves. The work is harder alone, but you feel proud.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<br><<gainStat "strength" "basestrength" 1 5 40 "Strength">>
<<gainExp 200>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _npc.externalTrait eq "Power-hungry">>
<<if _npc.gender eq "male">>
He scoffs. <span class="male1">"Menial labor suits you. Maybe you'll learn your place."</span>
<<else>>
She scoffs. <span class="female">"Menial labor suits you. Maybe you'll learn your place."</span>
<</if>>
<br><<link "Ignore the insult and work harder">>
<<replace "#courtyard-choice">>
You focus on the task with determination. Let them think what they want.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 220>>
<<set $sectFavor += 2>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Snap back with wit">>
<<replace "#courtyard-choice">>
<span class="player">"And perhaps you'll learn that arrogance weakens the spirit."</span>
They glare at you but say nothing more. You've made an enemy, but you've earned respect.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<<gainExp 200>>
<br><<gainStat "corruption" "corruption" 2 0 50 "Corruption">>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _npc.externalTrait eq "Romantic" and _chance gte 85>>
<<if _npc.gender eq "male">>
He watches you work, a slight smile on his face. <span class="male1">"You know, sweat suits you. Maybe I'll stick around and watch..."</span>
<<else>>
She watches you work, a slight smile on her face. <span class="female">"You know, sweat suits you. Maybe I'll stick around and watch..."</span>
<</if>>
<br><<link "Play along ">>
<<replace "#courtyard-choice">>
<span class="player">"Keep watching then. Maybe you'll learn something."</span>
They smile, lingering longer than necessary. The attention is flattering.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<br><<gainStat "corruption" "corruption" 5 0 50 "Corruption">>
<<gainExp 150>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Brush off the comment">>
<<replace "#courtyard-choice">>
You focus on your work, ignoring the flirtation. Efficient and professional.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 180>>
<<set $sectFavor += 2>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
The disciple watches impassively, offering neither help nor insult.
<<startStatChanges>>
<<gainExp 150>>
<<set $sectFavor += 1>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
</div>
<<elseif $CurrentPcSectRank eq "Core Disciple" or $CurrentPcSectRank eq "True Disciple">>
You arrive to find a junior disciple already struggling with the work. They look up, startled to see a senior helping.
<div id="courtyard-senior-choice">
<<if _npc.internalTrait eq "Selfish">>
<<if _npc.gender eq "male">>
He frowns. <span class="male1">"Senior? Cleaning? Don't you have... people for that?"</span>
<<else>>
She frowns. <span class="female">"Senior? Cleaning? Don't you have... people for that?"</span>
<</if>>
<br><<link "Explain that duty has no rank">>
<<replace "#courtyard-senior-choice">>
<span class="player">"The sect comes before pride. If the courtyard needs cleaning, I clean it."</span>
They seem to absorb this. A lesson in humility.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 200>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _npc.externalTrait eq "Romantic" and _chance gte 88>>
<<if _npc.gender eq "male">>
The disciple watches you for a while, flustered. <span class="male1">"Such elegance, even while sweeping... it makes it hard to focus."</span>
<<else>>
The disciple watches you for a while, flustered. <span class="female">"Such elegance, even while sweeping... it makes it hard to focus."</span>
<</if>>
<br><<link "Flirt back">>
<<replace "#courtyard-senior-choice">>
<span class="player">"Then maybe you should come closer and help. I could use your focus."</span>
They blush deeply but step forward, working alongside you. The tension is delicious.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<br><<gainStat "corruption" "corruption" 8 0 50 "Corruption">>
<<gainExp 180>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Be kind but professional">>
<<replace "#courtyard-senior-choice">>
<span class="player">"Just focus on the work. We'll be done faster with two of us."</span>
They nod, embarrassed but grateful for the direction.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<<gainExp 170>>
<<set $sectFavor += 2>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _npc.internalTrait eq "Kind">>
<<if _npc.gender eq "male">>
He rushes to help. <span class="male1">"Let me assist, senior! It's the least I can do."</span>
<<else>>
She rushes to help. <span class="female">"Let me assist, senior! It's the least I can do."</span>
<</if>>
<br><<link "Accept and mentor them">>
<<replace "#courtyard-senior-choice">>
You work together, teaching them proper technique. By the time you finish, they've learned something valuable.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 200>>
<<set $sectFavor += 4>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
A junior disciple is struggling with the work. You help them finish efficiently.
<<startStatChanges>>
<<gainExp 150>>
<<set $sectFavor += 2>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
</div>
<<else>>
<!-- Fallback for any other rank, including "Disciple" and "Inner Disciple" -->
A nearby disciple glances at you while you work but doesn't interfere. You finish your task efficiently.
<<startStatChanges>>
<<gainExp 150>>
<<set $sectFavor += 1>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
ASSIST ALCHEMY HALL - EXPANDED
═══════════════════════════════════════════════════════════════ -->
<<widget "AssistAlchemy01">>
You enter the Alchemy Hall, where three furnaces blaze with spiritual fire and the air shimmers with alchemical vapors.
The head alchemist, Elder Wu, nods at you. <span class="male1">"Good. We need help grinding herbs and monitoring the second furnace. Don't touch anything without asking first."</span>
<<set _roll to random(1,5)>>
<div id="alchemy-choice">
<<if _roll eq 1>>
<br><<link "Carefully grind the Frost Lotus Root">>
<<replace "#alchemy-choice">>
You work with meticulous precision, grinding the delicate petals into fine powder. Your focus impresses Elder Wu.<br>
<br>
<span class="male1">"Good work. Precision is the soul of alchemy."</span>
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 250>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Experiment with the mortar technique">>
<<replace "#alchemy-choice">>
You try an unconventional grinding method that actually works better than expected.<br>
<br>
Elder Wu raises an eyebrow. <span class="male1">"Hm. Unorthodox, but effective. You have instincts for this."</span>
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 3 5 40 "Insight">>
<<gainExp 280>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll eq 2>>
<br><<link "Monitor the furnace carefully">>
<<replace "#alchemy-choice">>
You watch the second furnace for hours, adjusting the heat with subtle qi manipulations. The batch completes perfectly.<br>
<br>
<span class="male1">"Excellent control. This batch will yield high-grade pills."</span>
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 1 10 40 "Spiritual Root">>
<<gainExp 320>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Rush the process to finish early">>
<<replace "#alchemy-choice">>
You push the furnace temperature higher to complete the batch faster. It works, but the pills are slightly lower quality.<br>
<br>
Elder Wu frowns. <span class="male1">"Impatience wastes potential. Learn this lesson."</span>
<<startStatChanges>>
<<gainExp 180>>
<<set $ContributionPoints += 8>>
<br><<gainStat "corruption" "corruption" 3 0 50 "Corruption">>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll eq 3>>
You're mixing reagents when one of the younger apprentices spills a golden tonic down your robe. It clings unpleasantly.<br>
<br>
<span class="male1">"Oh no! I'm so sorry, Senior Sister!"</span>
<br><<link "Forgive them kindly">>
<<replace "#alchemy-choice">>
<span class="player">"Accidents happen. Just be more careful next time."</span><br>
<br>
They're grateful for your patience. Elder Wu notices your kindness.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 200>>
<<set $ContributionPoints += 15>>
<<set $sectFavor += 2>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Use it as a teaching moment">>
<<replace "#alchemy-choice">>
<span class="player">"Carelessness like this could have ruined a batch worth months of work. Focus."</span><br>
<br>
The apprentice is chastened, but you've made your point about standards.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 220>>
<<set $ContributionPoints += 18>>
<br><<gainStat "corruption" "corruption" 2 0 50 "Corruption">>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll eq 4>>
A pinkish cloud rises from spilled aphrodisiac powder—and you inhale it directly before you can stop yourself.<br>
<br>
The scent hits you fast: warm, heady, almost sweet. Heat crawls down your throat and pools low in your belly.<br>
<br>
Your skin prickles, thighs pressing together instinctively. A blush creeps up your face as your breathing grows shallow.
<img src="images/Sex/aphrodisiac.webp" width=600>
Your nipples tighten beneath your robes. You feel wetness gathering between your legs.
<<if $corruption gt 40>>
<br><<link "Excuse yourself and find relief">>
<<replace "#alchemy-choice">>
You stumble out of the hall, claiming you need air. Behind a nearby storage building, you slip your hands beneath your robes, fingers finding your aching sex.<br>
<br>
You work quickly, breath coming in gasps, until release floods through you in waves. Your legs shake as you compose yourself.<br>
<br>
You return to the hall flushed but functional. Elder Wu doesn't comment, though his eyes are knowing.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 15 0 50 "Corruption">>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<<gainExp 150>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Push through the arousal">>
<<replace "#alchemy-choice">>
You clench your teeth and focus on the work, your body screaming in protest. It's agonizing, but you finish the shift without compromising yourself.<br>
<br>
Elder Wu watches you with new respect. <span class="male1">"Remarkable discipline."</span>
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 3 5 40 "Willpower">>
<<gainExp 300>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
<br><<link "Push through the arousal">>
<<replace "#alchemy-choice">>
You clench your teeth and focus on the work, your body screaming in protest. It's agonizing, but you finish the shift without compromising yourself.<br>
<br>
Elder Wu watches you with new respect. <span class="male1">"Remarkable discipline."</span>
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 3 5 40 "Willpower">>
<<gainExp 300>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<</if>>
<<else>>
<br><<link "Help with herb preparation">>
<<replace "#alchemy-choice">>
You spend the day sorting and preparing ingredients, learning their properties as you work.
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 1 5 40 "Insight">>
<<gainExp 200>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<</if>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
DELIVER SUPPLIES - EXPANDED
═══════════════════════════════════════════════════════════════ -->
<<widget "DeliverSupplies01">>
The box on your shoulder is heavy. Bottles of spirit water clink together with every step, and the scent of herbal salve clings to your robes.<br>
<br>
The outer quarters lie far beyond the inner courtyard—humble huts built beneath the shade of ancient trees. Most who live there are injured, overworked, or too weak to progress.
<<set _roll to random(1,100)>>
<div id="deliver-choice">
<<if _roll lte 30>>
As you make your rounds, you find an elderly disciple struggling to move. Their joints are swollen, qi depleted.
<br><<link "Spend extra time helping them">>
<<replace "#deliver-choice">>
You sit with them for an hour, massaging their shoulders and teaching them a breathing technique that helps circulation.<br>
<br>
<span class="oldman">"Bless you, young cultivator. Such kindness is rare here."</span>
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 280>>
<<set $sectFavor += 5>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Leave them with the supplies and continue">>
<<replace "#deliver-choice">>
You distribute the supplies quickly and professionally. The elder thanks you, though their eyes seem sad.
<<startStatChanges>>
<<gainExp 200>>
<<set $ContributionPoints += 12>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Suggest they seek the Healing Hall ">>
<<replace "#deliver-choice">>
<span class="player">"Your condition requires proper treatment. Go to the Healing Hall and mention my name."</span><br>
<br>
They nod, hopeful. You complete your rounds efficiently.
<<startStatChanges>>
<<gainExp 220>>
<<set $ContributionPoints += 15>>
<<set $sectFavor += 2>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll gte 70>>
You encounter a young disciple alone in one of the huts, feverish and delirious. Medicine lies untouched on the table.
<<CreateNPC001>>
<br><<link "Care for them personally ">>
<<replace "#deliver-choice">>
You spend hours tending to them—cooling their forehead with damp cloths, coaxing them to drink medicine, monitoring their breathing.<br>
<br>
By evening, their fever breaks. They look at you with gratitude and something more complex.
<<if _npc.gender eq "female">>
<span class="female">"Thank you... I was so scared..."</span>
<<else>>
<span class="male1">"Thank you... I was so scared..."</span>
<</if>>
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 3 5 40 "Charisma">>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 350>>
<<set $sectFavor += 6>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Fetch the Healing Hall disciples to take over">>
<<replace "#deliver-choice">>
You quickly run to fetch proper medical assistance. The trained healers arrive and stabilize the disciple.<br>
<br>
The Healing Master thanks you for the prompt action.
<<startStatChanges>>
<<gainExp 200>>
<<set $ContributionPoints += 10>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
You make routine deliveries. Most disciples thank you politely. A few refuse to meet your eyes, ashamed of their status.<br>
<br>
You distribute everything as instructed and return to the sect.
<<startStatChanges>>
<<gainExp 180>>
<<set $ContributionPoints += 12>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
TEND BEASTS - EXPANDED WITH TWIST EVENT
═══════════════════════════════════════════════════════════════ -->
<<widget "TendBeasts01">>
You arrive at the Spirit Beast Pens carrying heavy wooden buckets of spirit-infused grain and fresh mountain spring water.
<<set _heatRoll to random(1, 100)>>
<div id="beasts-choice">
<<if _heatRoll <= 30>>
<!-- Beast Heat Twist Event -->
As you approach the enclosure, a massive Crimson-Crested Crane shrieks, its feathers ruffled and eyes glazed with feverish intensity. It's in the middle of its mating cycle!<br>
<br>
The beast aggressively snaps its razor-sharp beak, Yang energy completely out of control.
<br><<link "Use Soothing Lotus incense ">>
<<replace "#beasts-choice">>
You carefully retrieve the rare Soothing Lotus incense from the sect's supplies and begin the proper ritual. The beast gradually calms, its wild energy subsiding.<br>
<br>
You channel your Qi gently, working with the beast's natural rhythm rather than against it.<br>
<br>
The Crane settles, docile once more. You finish cleaning the pen without incident.<br>
<br>
Elder who oversees the beasts watches from afar. <span class="male1">"Excellent technique. Few handle beast heat with such grace."</span>
<<startStatChanges>>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 3 10 40 "Spiritual Root">>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<<gainExp 400>>
<<set $sectFavor += 8>>
<<set $ContributionPoints += 25>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Attempt to sedate it with minimal resources ">>
<<replace "#beasts-choice">>
You try a quicker method using minor sedatives instead of the expensive incense. It partially works, but the beast remains agitated.<br>
<br>
You manage to finish the task, though you get a minor scratch on your arm. The cleanup is messy.
<<startStatChanges>>
<br><<gainStat "strength" "basestrength" 1 5 40 "Strength">>
<<gainExp 280>>
<<set $ContributionPoints += 15>>
<br><<gainStat "corruption" "corruption" 3 0 50 "Corruption">>
<<showStatChanges>>
You should have used proper protocol.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Attempt to channel its energy into your own cultivation ">>
<<replace "#beasts-choice">>
The beast's Yang energy is intoxicating. You try to absorb some of it, syncing your qi with its mating frenzy.<br>
<br>
For a moment, power floods through you—ecstatic, overwhelming, carnal.
<img src="images/Story/beastcultivation.webp" width=600>
Then the Crane's talons rake across your shoulder, bringing you crashing back to reality.<br>
<br>
You finish the task in pain and shame. The Elder notices your injury but says nothing—yet.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 2 0 50 "Corruption">>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 2 10 40 "Spiritual Root">>
<<gainExp 200>>
<<set $health to Math.max(0, $health - 30)>>
<<set $sectSuspicion += 5>>
<<showStatChanges>>
This was unwise. Very unwise.
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
<!-- Normal Event -->
The Elder's Spirit Cranes are relatively docile today. You spend a peaceful, if slightly smelly, few hours feeding them, sweeping away molted spirit feathers, and scrubbing down the stone floors.
<br><<link "Complete the task with perfect diligence">>
<<replace "#beasts-choice">>
You finish thoroughly and professionally. The pens are spotless, the beasts content.
<<startStatChanges>>
<<gainExp 220>>
<<set $ContributionPoints += 16>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Go through the motions quickly">>
<<replace "#beasts-choice">>
You complete the work adequately, though not with great care. The beasts are fed, the pens passable.
<<startStatChanges>>
<<gainExp 150>>
<<set $ContributionPoints += 10>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<</if>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
ORGANIZE SCRIPTURE PAVILION - EXPANDED
═══════════════════════════════════════════════════════════════ -->
<<widget "ScripturePavilion01">>
The Scripture Pavilion is perfectly quiet, smelling faintly of old bamboo and spiritual ink. Dust motes dance in the afternoon light filtering through high windows.
<<set _roll to random(1,5)>>
<div id="scripture-choice">
<<if _roll eq 1>>
<br><<link "Organize diligently and study what you find">>
<<replace "#scripture-choice">>
As you sort jade slips, you pause to read passages about cultivation theory. Hours pass in learning.
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 3 5 40 "Insight">>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 1 10 40 "Spiritual Root">>
<<gainExp 300>>
<<set $ContributionPoints += 18>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll eq 2>>
<br><<link "Work quickly to finish early">>
<<replace "#scripture-choice">>
You organize everything efficiently and leave within a few hours. The pavilion keeper appreciates the speed.
<<startStatChanges>>
<<gainExp 180>>
<<set $ContributionPoints += 12>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll eq 3>>
While organizing, you accidentally activate a damaged jade slip. It projects a flickering illusion of an ancient sword fairy practicing an ethereal stance.
<br><<link "Study the technique carefully">>
<<replace "#scripture-choice">>
You watch the illusion intently, committing the movements to memory. It's beautiful and instructive.
<<startStatChanges>>
<br><<gainStat "martialArts" "basemartialArts" 2 10 40 "Martial Arts">>
<<gainExp 280>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Watch it briefly then continue working">>
<<replace "#scripture-choice">>
You enjoy the moment but focus on the task at hand.
<<startStatChanges>>
<<gainExp 200>>
<<set $ContributionPoints += 14>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _roll eq 4>>
You notice a hidden compartment behind one of the oldest shelves. Inside is a collection of forbidden scrolls about forbidden dual cultivation techniques.
<br><<link "Report the discovery to the Elders">>
<<replace "#scripture-choice">>
You immediately inform the pavilion keeper and the Sect authorities. They're impressed by your integrity.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 250>>
<<set $sectFavor += 6>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Read them quickly before reporting">>
<<replace "#scripture-choice">>
You flip through the scrolls, absorbing forbidden knowledge before turning them in. Your knowledge is now dangerous.
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<br><<gainStat "corruption" "corruption" 2 0 50 "Corruption">>
<<gainExp 280>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Keep them hidden and study later ">>
<<replace "#scripture-choice">>
You carefully conceal the scrolls, planning to study them in secret. This is direct betrayal of sect trust.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 3 0 50 "Corruption">>
<<gainExp 200>>
<<set $sectSuspicion += 3>>
<<showStatChanges>>
You now possess dangerous knowledge, but discovery would be catastrophic.
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
You spend a peaceful afternoon sorting and dusting. The work is meditative and calm.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 180>>
<<set $ContributionPoints += 12>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
INVESTIGATE DORMITORY DISTURBANCE - EXPANDED
═══════════════════════════════════════════════════════════════ -->
<<widget "DormDisturbance01">>
You patrol the Outer Disciple dormitories late at night, investigating Elder complaints of "strange, rhythmic thumping and suppressed noises."<br>
<br>
Tracing the sound to a secluded storage shed behind the alchemy labs, you peek through a crack in the bamboo wall.<br>
<br>
Inside, illuminated by the soft glow of a night pearl, are a Junior Brother and Junior Sister deeply engaged in unorthodox Yin-Yang dual cultivation, completely ignoring sect curfew!
<<CreateNPC001>>
<<set $targetNPC to clone(_npc)>>
<div id="dorm-choices">
<br><<link "Report them strictly">>
<<replace "#dorm-choices">>
You loudly clear your throat and kick the door open, causing them to shriek and scramble for their scattered robes. You confiscate their identity tokens and officially report them to the Discipline Hall.<br>
<br>
Your strict adherence to sect rules earns the Elder's praise, though the outer disciples will surely curse your name.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 280>>
<<set $sectFavor += 7>>
<<set $ContributionPoints += 20>>
<br><<gainStat "corruption" "corruption" -5 0 50 "Corruption">>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Blackmail them for resources ">>
<<replace "#dorm-choices">>
You tap a rhythm on the door and demand a "privacy fee" to look the other way. Flustered and terrified of expulsion, they quickly pool together their monthly stipend of spirit stones and slide it under the door.<br>
<br>
You walk away with heavier pockets and a smug smile. No one will know.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 4 0 50 "Corruption">>
<<gainExp 200>>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<<set $gold += 150>>
<<set $sectSuspicion += 4>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Offer to 'supervise' their cultivation">>
<<replace "#dorm-choices">>
You step inside, calmly locking the door behind you. The two disciples stare in shock.<br>
<br>
<span class="player">"I noticed dangerous flaws in your Qi circulation. As a senior, I should help correct them."</span><br>
<br>
They hesitate, then nod nervously. What follows is an intense, breathless night of "hands-on tutoring."<br>
<br>
You work between them, teaching them to balance Yin and Yang through intimate contact. By dawn, your meridians feel incredibly satisfied, and they're exhausted but grateful.
<img src="images/Sex/dualcultivation.webp" width=600>
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 4 0 50 "Corruption">>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 2 10 40 "Spiritual Root">>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 400>>
<<set $dualCultivationCount += 1>>
<<set $sectSuspicion += 6>>
<<set $arousal to 0>>
<<showStatChanges>>
You return exhausted but power-rich. This secret must be kept carefully.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Warn them and let them go (Mercy)">>
<<replace "#dorm-choices">>
You knock softly and warn them before the Elder's rounds pass through. They scramble to compose themselves and thank you profusely.<br>
<br>
<span class="female">"Thank you, Senior Sister. We'll be more careful..."</span>
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 220>>
<<set $sectFavor += 2>>
<br><<gainStat "corruption" "corruption" -3 0 50 "Corruption">>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
JUNIOR DISCIPLE SPARRING - FULLY REVISED VERSION
Combines timed combat system with dynamic rank scaling
═══════════════════════════════════════════════════════════════ -->
<<widget "JuniorSpar01">>
<<if $pe eq 0>>
<<set $sparringRound = 1>>
<<set $playerWins = 0>>
<<set $juniorWins = 0>>
<<CreateNPC001>>
<<set $juniorNPC to clone(_npc)>>
<<set $juniorNPC.friendship to $juniorNPC.friendship || 0>>
<<set $juniorNPC.hadSex to $juniorNPC.hadSex || 0>>
<!-- Set Age and Sect Affiliation -->
<<set $juniorNPC.lifespan to random(18, 24)>>
<<set $juniorNPC.sectNPC to $CurrentPcAffiliation>>
<!-- Dynamically Determine Lower Rank (Max: Disciple) -->
<<set _sectRanks = ["Initiate", "Disciple", "Inner Disciple", "Core Disciple", "True Disciple", "Elder", "Great Elder", "Sect Leader"]>>
<<set _pcRankIndex = _sectRanks.indexOf($CurrentPcSectRank)>>
<<if _pcRankIndex lte 0>>
<<set $juniorNPC.NPCrank to "Initiate">>
<<elseif _pcRankIndex eq 1>>
<<set $juniorNPC.NPCrank to "Initiate">>
<<else>>
<!-- Player is Inner Disciple or higher; Junior can be Initiate or Disciple -->
<<set $juniorNPC.NPCrank to either("Initiate", "Disciple")>>
<</if>>
<!-- Build Junior's Wager Pool Based on Player Corruption -->
<<set _betOptions = ["touch your thigh", "rest a hand on your chest", "feel your ass", "see your panties"]>>
<<if $corruption gt 35>>
<<run _betOptions.push("rub your bare cunt")>>
<<if $juniorNPC.gender eq "male">>
<<run _betOptions.push("get a handjob from you")>>
<<else>>
<<run _betOptions.push("finger your pussy")>>
<</if>>
<</if>>
<<if $corruption gt 65>>
<<if $juniorNPC.gender eq "male">>
<<run _betOptions.push("get a blowjob from you", "fuck your bare pussy")>>
<<else>>
<<run _betOptions.push("have you eat me out", "grind against your bare pussy")>>
<</if>>
<</if>>
<<set _juniorWants = _betOptions.random()>>
<!-- Set Junior's Depravity Based on Their Chosen Wager -->
<<if ["get a blowjob from you", "have you eat me out", "fuck your bare pussy", "grind against your bare pussy"].includes(_juniorWants)>>
<<set $juniorNPC.depravity to random(70, 100)>>
<<elseif ["rub your bare cunt", "get a handjob from you", "finger your pussy"].includes(_juniorWants)>>
<<set $juniorNPC.depravity to random(40, 69)>>
<<elseif ["touch your thigh", "rest a hand on your chest", "feel your ass", "see your panties"].includes(_juniorWants)>>
<<set $juniorNPC.depravity to random(20, 39)>>
<<else>>
<<set $juniorNPC.depravity to random(5, 19)>>
<</if>>
<<set _roll = random(0, 100)>>
<!-- Initial Approach -->
<<if _roll lte 85>>
You enter the courtyard. $juniorNPC.fullname spots you and grins eagerly.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"Senior Sister! Let's make this interesting. Want to bet on it?"</span><br><br>
<<else>>
<span class="female">"Senior Sister! Let's make this interesting. Want to bet on it?"</span><br><br>
<</if>>
<span class="player">"What kind of bet did you have in mind?"</span><br><br>
They smirk, clearly testing your boundaries and enjoying the boldness.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"How about this – if I win... I get to _juniorWants?"</span><br><br>
<<else>>
<span class="female">"How about this – if I win... I get to _juniorWants?"</span><br><br>
<</if>>
<div id="bet-choice">
<<if $corruption gt 35>>
<<link "Raise the stakes ">>
<<replace "#bet-choice">>
<span class="player">"That's bold. But I counter – if I win..."</span><br><br>
<<set $pe to 1>>
<<link "Continue" $missionpassage>><</link>>
<</replace>>
<</link>><br>
<</if>>
<<if $corruption gt 20>>
<<link "Accept the bet">>
<<replace "#bet-choice">>
<span class="player">"Alright. Let's do it."</span><br><br>
<<set $sparBetStake to _juniorWants>>
<<set $playerBetDemand to "none">>
<<set $pe to 3>>
<<link "Ready yourself..." $missionpassage>><</link>>
<</replace>>
<</link>><br>
<</if>>
<<link "Refuse the wager">>
<<replace "#bet-choice">>
<span class="player">"That's inappropriate. Just a friendly spar."</span><br><br>
<<set $sparBetStake to "none">>
<<set $playerBetDemand to "none">>
<<set $pe to 3>>
<<link "Prepare to spar" $missionpassage>><</link>>
<</replace>>
<</link>>
</div>
<<else>>
<!-- Alternative path - they approach more respectfully -->
You enter the courtyard. $juniorNPC.fullname approaches respectfully.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"Senior Sister! Would you spar with me? I'd like to improve."</span><br><br>
<<else>>
<span class="female">"Senior Sister! Would you spar with me? I'd like to improve."</span><br><br>
<</if>>
<div id="spar-choice">
<<link "Accept a friendly bout">>
<<replace "#spar-choice">>
<span class="player">"Of course. Show me what you've learned."</span><br><br>
<<set $sparBetStake to "none">>
<<set $playerBetDemand to "none">>
<<set $pe to 3>>
<<link "Begin sparring" $missionpassage>><</link>>
<</replace>>
<</link>><br>
<<if $corruption gt 25>>
<<link "Suggest a wager">>
<<replace "#spar-choice">>
<span class="player">"How about we make it interesting?"</span><br><br>
<<gainStat "corruption" "corruption" 2 0 50 "Corruption">>
<<set $pe to 1>>
<<goto $missionpassage>>
<</replace>>
<</link>>
<</if>>
</div>
<</if>>
<!-- Integrated logic for $pe eq 1 -->
<<elseif $pe eq 1>>
<div id="pe1-container">
<span class="player">"Alright – but if I win, I want..."</span><br><br>
<!-- Player builds their demand based on corruption -->
<<set _playerOptions = ["100 spirit stones", "250 spirit stones"]>>
<<if $corruption gt 40>>
<<run _playerOptions.push("500 spirit stones", "you to strip shirtless")>>
<</if>>
<<if $corruption gt 75>>
<<if $juniorNPC.gender eq "male">>
<<run _playerOptions.push("to ride your cock")>>
<<else>>
<<run _playerOptions.push("you to eat me out")>>
<</if>>
<</if>>
<div id="raise-choice">
<<for _idx, _opt range _playerOptions>>
<<capture _opt>>
<<link _opt>>
<<replace "#pe1-container">>
<span class="player">"...I want _opt."</span><br><br>
<<set $playerBetDemand to _opt>>
<<set $sparBetStake to _juniorWants>>
<!-- NPC Reaction -->
They whistle softly, eyes widening.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"Bold of you, Senior Sister."</span><br><br>
<<else>>
<span class="female">"Bold of you, Senior Sister."</span><br><br>
<</if>>
<!-- Logic for Escalation -->
<<if ($playerBetDemand eq "you to strip shirtless" or $playerBetDemand eq "to ride your cock" or $playerBetDemand eq "you to eat me out") and $juniorNPC.depravity lt 30>>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"That's... that's actually a bit much for me. Let's just stick to sparring."</span><br><br>
<<else>>
<span class="female">"That's... that's actually a bit much for me. Let's just stick to sparring."</span><br><br>
<</if>>
<<set $sparBetStake to "none">>
<<set $playerBetDemand to "none">>
<<set $pe to 3>>
<<link "Begin match" $missionpassage>><</link>>
<<else>>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"You're on. Let's see what you've got."</span><br><br>
<<else>>
<span class="female">"You're on. Let's see what you've got."</span><br><br>
<</if>>
<<set $pe to 3>>
<<link "Begin match" $missionpassage>><</link>>
<</if>>
<</replace>>
<</link>><br>
<</capture>>
<</for>>
</div>
</div>
<!-- Combat Round Start -->
<<elseif $pe eq 3>>
<<set $missionpassage to passage()>>
<div class="sparring-round">
<strong>Round <<print $sparringRound>></strong><br>
<b>You:</b> <<print $playerWins>> || <b>$juniorNPC.fullname:</b> <<print $juniorWins>><br><br>
$juniorNPC.fullname circles you, eyes focused and determined.<br><br>
<<set $juniorMove to either("strike", "block", "feint")>>
<<if $juniorNPC.gender eq "male">>
<span class="male1">He prepares to $juniorMove!</span><br><br>
<<else>>
<span class="female">She prepares to $juniorMove!</span><br><br>
<</if>>
<div id="countdown-timer">
Countdown: <strong><span id="time-left">5</span></strong> seconds!<br><br>
</div>
<div id="action-buttons">
<<link "Strike">>
<<set $playerMove to "strike">>
<<set $pe to 4>>
<<goto $missionpassage>>
<</link>><br>
<<link "Block">>
<<set $playerMove to "block">>
<<set $pe to 4>>
<<goto $missionpassage>>
<</link>><br>
<<link "Feint">>
<<set $playerMove to "feint">>
<<set $pe to 4>>
<<goto $missionpassage>>
<</link>>
</div>
<<silently>>
<<timed 1s>>
<<replace "#time-left">>4<</replace>>
<<next 1s>>
<<replace "#time-left">>3<</replace>>
<<next 1s>>
<<replace "#time-left">>2<</replace>>
<<next 1s>>
<<replace "#time-left">>1<</replace>>
<<next 1s>>
<<set $playerMove to "none">>
<<set $pe to 4>>
<<goto $missionpassage>>
<</timed>>
<</silently>>
</div>
<!-- Resolve Combat Round -->
<<elseif $pe eq 4>>
<<set $missionpassage to passage()>>
<!-- Tie -->
<<if $playerMove eq $juniorMove>>
It's a tie! Neither of you land a clean hit. The tension rises as you circle each other.<br><br>
<<set $sparringRound += 1>>
<<set $pe to 3>>
<<link "Next round...">>
<<goto $missionpassage>>
<</link>>
<!-- Player Wins Round -->
<<elseif ($playerMove eq "strike" and $juniorMove eq "feint") or
($playerMove eq "block" and $juniorMove eq "strike") or
($playerMove eq "feint" and $juniorMove eq "block")>>
<<set _pinchance to random(0, 100)>>
<<if _pinchance lte 15 and $sparringRound gt 1>>
<img src="images/Story/pinfall1.png" class="center" width="600"><br><br>
With a sharp twist, you sweep their leg and send them crashing to the ground... You win this round decisively!<br><br>
<<else>>
You win this round with a decisive strike!<br><br>
<</if>>
<<set $playerWins += 1>>
<<if $playerWins gte 3>>
<<set $pe to 5>>
<<link "Continue..." $missionpassage>><</link>>
<<else>>
<<set $sparringRound += 1>>
<<set $pe to 3>>
<<link "Next round...">>
<<goto $missionpassage>>
<</link>>
<</if>>
<!-- Junior Wins Round -->
<<else>>
<<set _pinchance to random(0, 100)>>
<<if _pinchance lte 15 and $sparringRound gt 1>>
<img src="images/Story/pinfall.png" class="center" width="600"><br><br>
You stumble from their final strike—and before you can recover, they lunge, tackling you...<br><br>
<<else>>
$juniorNPC.fullname wins this round with a swift counter!<br><br>
<</if>>
<<set $juniorWins += 1>>
<<if $juniorWins gte 3>>
<<set $pe to 5>>
<<link "Continue..." $missionpassage>><</link>>
<<else>>
<<set $sparringRound += 1>>
<<set $pe to 3>>
<<link "Next round...">>
<<goto $missionpassage>>
<</link>>
<</if>>
<</if>>
<!-- End of Spar - Player Wins -->
<<elseif $pe eq 5 and $playerWins gte 3>>
You've bested $juniorNPC.fullname decisively. They collapse to their knees, chest heaving.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"I... I couldn't match you..."</span><br><br>
<<else>>
<span class="female">"I... I couldn't match you..."</span><br><br>
<</if>>
<<if $playerBetDemand neq "none" and $playerBetDemand neq undefined>>
<div id="victory-choice">
<<link "Claim your winnings">>
<<replace "#victory-choice">>
<span class="player">"A deal is a deal. Pay up."</span><br><br>
<<if $playerBetDemand.includes("spirit stones")>>
With a heavy sigh, they pull a pouch from their robes and hand over the spirit stones.<br><br>
<<if $playerBetDemand eq "100 spirit stones">><<set $money += 100>>
<<elseif $playerBetDemand eq "250 spirit stones">><<set $money += 250>>
<<elseif $playerBetDemand eq "500 spirit stones">><<set $money += 500>>
<</if>>
<strong>Received $playerBetDemand!</strong><br><br>
<<elseif $playerBetDemand eq "you to strip shirtless">>
Blushing furiously, they untie their robes and let them fall to the dirt. You slowly circle them, enjoying the sight of their bare chest heaving with exertion under your hungry gaze.<br><br>
<<if $corruption lt 25>><<set $corruption += 2>><</if>>
<<elseif $playerBetDemand eq "to ride your cock">>
<img src="images/Sex/playerBetRideMale.webp" width="600"><br><br>
He swallows hard, lying back on the dirt as you demand. You pull his robes open, freeing his thick, throbbing cock. Without hesitation, you hike up your own robes, exposing your dripping pussy, and lower yourself fully onto his hard shaft. He groans loudly as you sink all the way down, riding him ruthlessly right there in the courtyard until you milk every drop of hot cum from his balls.<br><br>
<<if $corruption lt 85>><<set $corruption += 5>><</if>>
<<set $juniorNPC.hadSex += 1>>
<<elseif $playerBetDemand eq "you to eat me out">>
<img src="images/Sex/playerBetEatFemale.webp" width="600"><br><br>
You force her onto her knees, parting your legs to expose your soaking wet pussy directly in front of her face. "Lick," you command. She trembles but obeys, burying her face between your thighs. Her tongue eagerly slathers over your swollen clit and slips into your dripping slit, eating you out furiously until your legs shake and you cum hard against her mouth.<br><br>
<<if $corruption lt 85>><<set $corruption += 5>><</if>>
<<set $juniorNPC.hadSex += 1>>
<</if>>
<<startStatChanges>>
<<gainStat "martialArts" "basemartialArts" 1 10 40 "Martial Arts">>
<<gainExp 300>>
<<set $juniorNPC.friendship += 10>>
<<showStatChanges>>
<div id="end-options">
<br><br>
<<link "Add $juniorNPC.fullname to Book of Connections" $passage>>
<<AddNPCWithFamily $juniorNPC>>
<<MissionFinishAuto>>
<</link>><br>
<<link "Depart courtyard" $passage>>
<<MissionFinishAuto>>
<</link>>
</div>
<</replace>>
<</link>>
</div>
<<else>>
<!-- Original Default Victory Choices -->
<div id="victory-choice">
<<link "Offer a hand up graciously">>
<<replace "#victory-choice">>
You extend your hand with a warm smile. They take it, pulling themselves up as respect flickers in their eyes.<br><br>
<<startStatChanges>>
<<gainStat "martialArts" "basemartialArts" 1 10 40 "Martial Arts">>
<<gainExp 250>>
<<set $ContributionPoints += 15>>
<<set $sectFavor += 3>>
<<set $juniorNPC.friendship += 15>>
<<showStatChanges>>
<div id="end-options">
<br><br>
<<link "Add $juniorNPC.fullname to Book of Connections" $passage>>
<<AddNPCWithFamily $juniorNPC>>
<<MissionFinishAuto>>
<</link>><br>
<<link "Depart courtyard" $passage>>
<<MissionFinishAuto>>
<</link>>
</div>
<</replace>>
<</link>><br>
<<link "Bask in their admiration">>
<<replace "#victory-choice">>
You smile knowingly as they gaze up at you with obvious respect and attraction.<br><br>
<<startStatChanges>>
<<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<<gainExp 280>>
<<set $juniorNPC.friendship += 5>>
<<showStatChanges>>
<div id="end-options">
<br><br>
<<link "Add $juniorNPC.fullname to Book of Connections" $passage>>
<<AddNPCWithFamily $juniorNPC>>
<<MissionFinishAuto>>
<</link>><br>
<<link "Depart courtyard" $passage>>
<<MissionFinishAuto>>
<</link>>
</div>
<</replace>>
<</link>>
</div>
<</if>>
<!-- End of Spar - Junior Wins (Bet to Collect) -->
<<elseif $pe eq 5 and $juniorWins gte 3>>
You're both breathing hard, exhausted from the intense match. $juniorNPC.fullname stands over you, eyes gleaming with victory.<br><br>
<<if $sparBetStake eq "touch your thigh">>
As you try to stand, they step into your space, pinning you lightly against the sparring post. Their hand slides warmly onto your bare thigh, squeezing the soft flesh intimately.<br><br>
<img src="images/Sex/juniorBetThigh.webp" width="600"><br><br>
You flush, struggling to maintain your composure under their bold touch as they smirk in absolute triumph.<br><br>
<<if $corruption lt 20>><<set $corruption += 2>><</if>>
<<elseif $sparBetStake eq "rest a hand on your chest">>
Without waiting for permission, they step forward and place their palm directly onto your chest. Their fingers intentionally spread wide, claiming the soft swell of your breast through your robes.<br><br>
<img src="images/Sex/juniorBetTits.webp" width="600"><br><br>
You stiffen, heat blooming in your cheeks—but they don't press harder, merely letting their hand linger possessively while staring deep into your eyes.<br><br>
<<if $corruption lt 25>><<set $corruption += 3>><</if>>
<<elseif $sparBetStake eq "feel your ass">>
Their hand slides boldly down the small of your back and settles firmly onto your ass. They knead the soft flesh aggressively through the silk of your robes, clearly savoring their prize.<br><br>
<img src="images/Sex/juniorBetAss.webp" width="600"><br><br>
You bite your lip to stifle a gasp as their fingers dig into your cheeks, enjoying the dominant display of victory.<br><br>
<<if $corruption lt 20>><<set $corruption += 3>><</if>>
<<elseif $sparBetStake eq "see your panties">>
Before you can even catch your breath, their hands are at your waist, yanking your robes high up to completely expose your panties.<br><br>
<img src="images/Sex/juniorBetPanties.webp" width="600"><br><br>
Their eyes rake hungrily over the thin fabric stretched across your crotch, their gaze burning into your obvious embarrassment. "Nice view," they mock softly.<br><br>
<<if $corruption lt 20>><<set $corruption += 3>><</if>>
<!-- EXPLICIT WAGERS -->
<<elseif $sparBetStake eq "rub your bare cunt">>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"I won. Spread your legs, Senior Sister."</span><br><br>
<<else>>
<span class="female">"I won. Spread your legs, Senior Sister."</span><br><br>
<</if>>
They don't give you a choice. They push you onto your back, hauling your robes up and pulling aside your underwear to completely expose your bare sex. Two fingers immediately press against your slick folds, rubbing your sensitive clit directly.<br><br>
<img src="images/Sex/juniorBetRubCunt.webp" width="600"><br><br>
A sharp, breathy moan escapes your lips as their digits work your wet flesh right there in the middle of the training grounds. You squirm helplessly as they continuously stroke your dripping slit.<br><br>
<<if $corruption lt 45>><<set $corruption += 5>><</if>>
<<set $juniorNPC.hadSex += 1>>
<<elseif $sparBetStake eq "get a handjob from you" or $sparBetStake eq "finger your pussy">>
They yank you close, forcing you onto your knees.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"Time to pay up. Get your hands on it."</span><br><br>
He rips his pants down, exposing his thick, hard length. A drop of pre-cum is already leaking from the swollen slit. He grabs your wrist, wrapping your fingers tightly around his hot shaft. You swallow hard, forced to stroke him in deep, rhythmic pulls while he groans and twitches in your grip.<br><br>
<<else>>
<span class="female">"Time to pay up. Let's see those skilled hands of yours."</span><br><br>
She parts her robes completely, spreading her legs to show off her pink, soaking wet pussy. She guides your fingers down to her dripping slit, forcing you to plunge them deep inside. You rapidly finger her wet hole, listening to her loud, wet moans echoing in the courtyard.<br><br>
<</if>>
<img src="images/Sex/juniorBetHandjob.webp" width="600"><br><br>
<<if $corruption lt 50>><<set $corruption += 6>><</if>>
<<set $juniorNPC.hadSex += 1>>
<<elseif $sparBetStake eq "get a blowjob from you" or $sparBetStake eq "have you eat me out">>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"On your knees, Senior Sister. Open wide."</span><br><br>
He shoves your shoulders down into the dirt. You kneel before him, parting your lips helplessly as he violently thrusts his thick, throbbing cock deep into your mouth. You gag slightly, forced to bob your head and suck his hot shaft, swallowing his slick pre-cum as you service him thoroughly.<br><br>
<<else>>
<span class="female">"On your knees, Senior Sister. Tongue out."</span><br><br>
She forces you down onto your back and forcefully straddles your face. You are completely smothered by her soaking wet cunt. You have no choice but to lap desperately at her dripping juices, eating her out while she aggressively grinds her swelling clit against your nose and lips.<br><br>
<</if>>
<img src="images/Sex/juniorBetOral.webp" width="600"><br><br>
<<if $corruption lt 75>><<set $corruption += 8>><</if>>
<<set $juniorNPC.hadSex += 1>>
<<elseif $sparBetStake eq "fuck your bare pussy" or $sparBetStake eq "grind against your bare pussy">>
The pretense of a "spar" is completely gone. They shove you forcefully onto your back on the hard ground, ripping your lower robes apart and tearing off your panties, leaving you completely exposed.<br><br>
<<if $juniorNPC.gender eq "male">>
<span class="male1">"You lost, Senior Sister. And now your tight little pussy belongs to me."</span><br><br>
He lines his massive, throbbing cock up with your wet, bare slit and violently buries himself deep inside you. You let out a loud, breathless scream as he begins to brutally pound you. His hips slap heavily against your thighs, ruthlessly plowing your pussy until he fills you with a hot, pulsing creampie right there on the training grounds.<br><br>
<<else>>
<span class="female">"You lost, Senior Sister. Spread them."</span><br><br>
She drops heavily between your spread thighs, pressing her bare, soaking wet pussy directly against yours. She begins to grind ruthlessly against you. Your slick clits rub together in a desperate, friction-filled rhythm, scissoring aggressively until your bodies spasm and you both climax screaming into the open air.<br><br>
<</if>>
<img src="images/Sex/juniorBetFuck.webp" width="600"><br><br>
<<if $corruption lt 90>><<set $corruption += 10>><</if>>
<<set $juniorNPC.hadSex += 1>>
<!-- Safe default if no bet -->
<<elseif $sparBetStake eq "none">>
You both collapse, laughing as you recover.<br><br>
<span class="player">"You've improved. Keep practicing."</span><br><br>
<</if>>
<<startStatChanges>>
<<gainExp 260>>
<<set $juniorNPC.friendship += 10>>
<<showStatChanges>>
<div id="end-options">
<br><br>
<<link "Add $juniorNPC.fullname to Book of Connections" $passage>>
<<AddNPCWithFamily $juniorNPC>>
<<MissionFinishAuto>>
<</link>><br>
<<link "Depart courtyard" $passage>>
<<MissionFinishAuto>>
<</link>>
</div>
<</if>>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
NEW MISSION: Guard the Meditation Chambers (Night Watch)
═══════════════════════════════════════════════════════════════ -->
<<widget "GuardMeditationChambers01">>
Night falls over the sect. You're assigned to guard the Meditation Chambers during the midnight hours—a quiet, meditative post that few juniors enjoy.<br>
<br>
The halls are dim, lit only by night pearls in their fixtures. Your footsteps echo softly as you patrol.
<<set _encounter = random(1,5)>>
<div id="meditation-choice">
<<if _encounter lte 2>>
<br><<link "Meditate peacefully in one of the empty chambers">>
<<replace "#meditation-choice">>
Rather than patrol constantly, you settle into one of the empty meditation chambers and deepen your own cultivation.<br>
<br>
Hours pass in serene silence. Your qi flows smoothly, and you emerge refreshed, your mind clear.<br>
<br>
The Meditation Hall Master notices your balanced energy.<br>
<br>
<span class="oldman">"You have a gift for stillness, disciple."</span>
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 2 10 40 "Spiritual Root">>
<<gainExp 350>>
<<set $sectFavor += 5>>
<<set $ContributionPoints += 18>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Patrol diligently and observe others' progress">>
<<replace "#meditation-choice">>
You walk the halls carefully, ensuring no one disturbs the meditating disciples. You notice how different cultivators' auras shine—some weak, some burning bright with advancement.<br>
<br>
By dawn, you've observed much about the sect's power distribution and spiritual health.
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<<gainExp 280>>
<<set $ContributionPoints += 15>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _encounter eq 3>>
At midnight, you discover a junior disciple weeping silently in one of the meditation chambers. They look distraught, their cultivation clearly disrupted by emotional turmoil.
<<CreateNPC001>>
<br><<link "Comfort them with genuine care">>
<<replace "#meditation-choice">>
You sit beside them and listen without judgment. They tell you of struggles with the sect, doubts about their path, loneliness.<br>
<br>
You offer both practical advice and emotional support. By the end, they're calmer, more centered.<br>
<br>
<span class="female">"Thank you... I needed to talk to someone."</span>
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 3 5 40 "Charisma">>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 320>>
<<set $sectFavor += 6>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Use their vulnerability to seduce them ">>
<<replace "#meditation-choice">>
Their emotional state makes them malleable. You take advantage, offering comfort that gradually becomes physical.<br>
<br>
Soon you're kissing them, hands exploring trembling bodies in the dim light of the meditation chamber.
<img src="images/Sex/meditationchamber.webp" width=600>
It's not entirely consensual, and you know it. But they don't resist.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 15 0 50 "Corruption">>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 300>>
<<set $dualCultivationCount += 1>>
<<set $sectSuspicion += 4>>
<<showStatChanges>>
You've gained power through their despair. The guilt is faint but present.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Suggest they speak to an Elder">>
<<replace "#meditation-choice">>
You recognize this is beyond your capacity to help properly.<br>
<br>
<span class="player">"The Counselor Elder understands these struggles. You should speak with them."</span><br>
<br>
They nod, grateful for the direction.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 250>>
<<set $sectFavor += 4>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _encounter eq 4>>
You discover two disciples engaged in secret cultivation in one of the back chambers—a form of advanced dual cultivation that's technically forbidden without Elder approval.
<br><<link "Report them (Righteousness)">>
<<replace "#meditation-choice">>
You interrupt them and immediately report to the Meditation Hall Master. Your adherence to sect rules is commended, though the disciples will resent you.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 280>>
<<set $sectFavor += 7>>
<<set $ContributionPoints += 20>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Join them ">>
<<replace "#meditation-choice">>
You step into the chamber and close the door. The two disciples stare in shock, then quickly realize you're not there to report them.<br>
<br>
<span class="female">"Senior Sister... would you..."</span><br>
<br>
What follows is an intense night of three-way cultivation, energies intertwining in forbidden harmony.
<img src="images/Sex/threeway.webp" width=600>
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 18 0 50 "Corruption">>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 3 10 40 "Spiritual Root">>
<<gainExp 400>>
<<set $dualCultivationCount += 1>>
<<set $sectSuspicion += 5>>
<<showStatChanges>>
You now have leverage over both of them. And they know it.
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
The night passes quietly. You patrol the halls, ensure everything is secure, and nothing of note occurs.
<<startStatChanges>>
<<gainExp 180>>
<<set $ContributionPoints += 12>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
NEW MISSION: Collect Spirit Herbs from the Forbidden Grotto
═══════════════════════════════════════════════════════════════ -->
<<widget "CollectHerbsGrotte01">>
The Elder hands you a list and a jade slip map.<br>
<br>
<span class="male1">"The Forbidden Grotto holds rare spirit herbs we need for autumn pills. You have the skills—bring back the ones marked on this map. Be careful. The grotto hasn't been entered in three years."</span><br>
<br>
You venture into the shadowy canyon. Strange qi hangs in the air—old, untamed, dangerous.
<<set _discovery = random(1,5)>>
<div id="grotto-choice">
<<if _discovery eq 1>>
<br><<link "Carefully collect only the marked herbs">>
<<replace "#grotto-choice">>
You work methodically, using proper technique to harvest each herb without damaging its spiritual essence.<br>
<br>
Hours pass. You gather everything on the list and prepare to leave, when you notice a hidden alcove you hadn't seen before.
<br><<link "Continue safely back to the sect">>
<<replace "#grotto-choice">>
You resist the temptation to explore further. Knowledge of unknown places is dangerous.
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 300>>
<<set $ContributionPoints += 20>>
<<set $sectFavor += 4>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Investigate the alcove ">>
<<replace "#grotto-choice">>
You approach cautiously. Inside is a shrine to an ancient cultivator—and a cultivation manual written in forbidden script.
<br><<link "Take it (Corruption +12)">>
<<replace "#grotto-choice">>
You carefully remove the ancient manual and hide it in your robes. The knowledge within could accelerate your growth—or doom you if discovered.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 12 0 50 "Corruption">>
<br><<gainStat "insight" "baseinsight" 3 5 40 "Insight">>
<<gainExp 350>>
<<set $ContributionPoints += 18>>
<<set $sectSuspicion += 3>>
<<showStatChanges>>
You now possess a secret of immense value. But danger comes with it.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Leave it untouched">>
<<replace "#grotto-choice">>
This knowledge belongs to the grotto, not to you. You respect that boundary and leave it where it lies.
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 280>>
<<set $ContributionPoints += 18>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<</replace>>
<</link>>
<<elseif _discovery eq 2>>
You find a rare Spirit Fox resting near the herbs you're collecting. It's beautiful, ethereal, and watching you with intelligent eyes.
<br><<link "Attempt to befriend it">>
<<replace "#grotto-choice">>
You move slowly, offering gentle energy to the fox. It approaches cautiously, and after long minutes, allows you to touch its fur.<br>
<br>
The connection is profound—ancient, almost sentient.
<img src="images/Story/spiritfox.webp" width=600>
When you finally leave, the fox doesn't follow, but you feel as if you've made a pact with something greater than yourself.
<<startStatChanges>>
<br><<gainStat "spiritualRoot" "basespiritualRoot" 3 10 40 "Spiritual Root">>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<<gainExp 380>>
<<set $ContributionPoints += 22>>
<<set $sectFavor += 5>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Attempt to capture it ">>
<<replace "#grotto-choice">>
You try to trap the fox with binding qi, thinking it could be valuable to the sect—or to you.<br>
<br>
The fox hisses and lashes out, clawing your arm. You release it immediately, and it vanishes into the shadows.
<<startStatChanges>>
<br><<gainStat "corruption" "corruption" 3 0 50 "Corruption">>
<br><<gainStat "agility" "baseagility" 1 7 40 "Agility">>
<<gainExp 220>>
<<set $health to Math.max(0, $health - 20)>>
<<showStatChanges>>
You escaped, but barely. The grotto feels hostile now.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Leave it alone and continue working">>
<<replace "#grotto-choice">>
You acknowledge the fox's presence respectfully and focus on your task. It watches but doesn't interfere.
<<startStatChanges>>
<<gainExp 280>>
<<set $ContributionPoints += 18>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _discovery eq 3>>
While gathering herbs, you discover evidence of another cultivator—recently, within days. Footprints, disturbed plants, even the remnants of a small camp.<br>
<br>
Someone else is accessing the forbidden grotto.
<br><<link "Report this to the Elders">>
<<replace "#grotto-choice">>
You bring the discovery to the authorities. They're concerned and grateful for your vigilance.<br>
<br>
<span class="male1">"This is serious. We may have an intruder. You did well."</span>
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 320>>
<<set $sectFavor += 8>>
<<set $ContributionPoints += 25>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Investigate further yourself ">>
<<replace "#grotto-choice">>
You follow the traces, curious about who has access to this place. You find a hidden cave where someone has been cultivating in secret.<br>
<br>
Evidence suggests it's one of the sect's own—someone powerful and careful.
<br><<link "Leave it alone and report nothing">>
<<replace "#grotto-choice">>
You back away quietly. This person—whoever they are—has chosen secrecy. Interfering could be dangerous.
<<startStatChanges>>
<br><<gainStat "insight" "baseinsight" 2 5 40 "Insight">>
<<gainExp 300>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
You now carry a dangerous secret. Information is power.
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Use this knowledge to blackmail them ">>
<<replace "#grotto-choice">>
You leave a message in their hidden cave—subtle, but clear: you know they're here, and you expect compensation for your silence.<br>
<br>
<br><<gainStat "corruption" "corruption" 3 0 50 "Corruption">>
<br>
They don't respond, but resources appear in your quarters within days. The arrangement is understood.
<<startStatChanges>>
<<gainExp 280>>
<<set $gold += 300>>
<<set $sectSuspicion += 5>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<</replace>>
<</link>>
<<else>>
You collect the herbs smoothly. Nothing unusual occurs.
<<startStatChanges>>
<<gainExp 250>>
<<set $ContributionPoints += 16>>
<<showStatChanges>>
<<MissionFinish>>
<</if>>
</div>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════
NEW MISSION: Assist with Sect Festival Preparations
═══════════════════════════════════════════════════════════════ -->
<<widget "SectFestivalPrep01">>
The Sect Festival is in three days, and Elder Liu needs help preparing. You're assigned to organize decorations, arrange the performance stage, and coordinate with various disciples.<br>
<br>
It's social work, but important for sect morale.
<<set _stage = random(1,4)>>
<div id="festival-choice">
<<if _stage eq 1>>
<br><<link "Organize the decorations with careful artistry">>
<<replace "#festival-choice">>
You work with several other disciples, arranging silk banners, spirit lanterns, and ritual flowers. Your eye for beauty makes the courtyard stunning.<br>
<br>
Other disciples comment on your aesthetic sense.<br>
<br>
<span class="female">"Senior Sister, this is beautiful!"</span>
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<<gainExp 280>>
<<set $sectFame += 3>>
<<set $ContributionPoints += 18>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Delegate tasks and supervise efficiently">>
<<replace "#festival-choice">>
You organize the other workers effectively, assigning tasks based on their skills. Everyone knows what to do, and the work finishes ahead of schedule.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<br><<gainStat "willpower" "basewillpower" 1 5 40 "Willpower">>
<<gainExp 250>>
<<set $ContributionPoints += 20>>
<<set $sectFavor += 3>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _stage eq 2>>
You're helping arrange the food and drink for the festival. A junior disciple—particularly attractive—is assigned to help you.
<<CreateNPC001>>
<<set $festivalNPC to clone(_npc)>>
<<if _npc.gender eq "female">>
<span class="female">"Senior Sister, where should the spirit wine go?"</span> she asks, struggling a bit with a heavy cask.
<<else>>
<span class="male1">"Senior Sister, where should the spirit wine go?"</span> he asks, struggling a bit with a heavy cask.
<</if>>
<br><<link "Help them with the cask professionally">>
<<replace "#festival-choice">>
You take the cask together, your hands briefly touching. You guide them in proper storage technique.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 1 5 40 "Charisma">>
<<gainExp 220>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Use the moment to flirt ">>
<<replace "#festival-choice">>
As you work, you stand unnecessarily close. Your hands linger when taking the cask.<br>
<br>
<span class="player">"You're stronger than you look. I like that."</span><br>
<br>
They blush deeply.
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 2 5 40 "Charisma">>
<br><<gainStat "corruption" "corruption" 6 0 50 "Corruption">>
<<gainExp 240>>
<<set $ContributionPoints += 14>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<<elseif _stage eq 3>>
You're coordinating the performance stage with musicians and martial artists. There's creative tension between different performers about who gets prime time slots.
<br><<link "Mediate fairly between everyone">>
<<replace "#festival-choice">>
You listen to each performer's needs and arrange a schedule that satisfies most people. It requires diplomacy and fairness.<br>
<br>
<span class="male1">"You have a gift for balance, Senior Sister."</span>
<<startStatChanges>>
<br><<gainStat "charisma" "basecharisma" 3 5 40 "Charisma">>
<<gainExp 300>>
<<set $sectFame += 4>>
<<set $ContributionPoints += 20>>
<<set $sectFavor += 4>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<br><<link "Give preference to the most attractive performers ">>
<<replace "#festival-choice">>
You arrange the schedule to feature the most beautiful disciples, regardless of actual talent. It's shallow, but you enjoy the view.
<<startStatChanges>>
<br><br><<gainStat "corruption" "corruption" 2 0 50 "Corruption">>
<<gainExp 250>>
<<set $ContributionPoints += 15>>
<<showStatChanges>>
The performances will be... visually interesting, at least.
<<MissionFinish>>
<</replace>>
<</link>>
<<else>>
<br><<link "Help with all aspects of preparation">>
<<replace "#festival-choice">>
You throw yourself into various tasks—decorations, coordination, problem-solving. By the time the festival arrives, you're exhausted but satisfied.<br>
<br>
The Elder thanks you directly.<br>
<br>
<span class="male1">"Your contribution was invaluable. The festival will be remembered."</span>
<<startStatChanges>>
<br><<gainStat "willpower" "basewillpower" 2 5 40 "Willpower">>
<<gainExp 320>>
<<set $sectFame += 5>>
<<set $sectFavor += 5>>
<<set $ContributionPoints += 25>>
<<showStatChanges>>
<<MissionFinish>>
<</replace>>
<</link>>
<</if>>
</div>
<</widget>><<widget "PatrolPerimeter01Submissive">>
<<nobr>>
<<set $missionpassage = $args[0] ?? $passage>>
/* Mission‑specific effects */
<<set $currentMissionEffects = {
corruption: random(3,5),
sexFame: 4,
righteousreputation: -2,
logTitle: "Mission Submission",
logDesc: "You submitted to a junior during a patrol, deepening your corruption."
}>>
<<set $missionDominance = "sub">>
<<set _partner = $juniorNPC>>
<<set $sexType = "mission_sex">>
<<set $sexReturnPassage = $missionpassage>>
<<goto "EncounterInteractionSex">>
<</nobr>>
<</widget>>
<<widget "PatrolPerimeter01Dominant">>
<<nobr>>
<<set $missionpassage = $args[0] ?? $passage>>
/* Mission‑specific effects */
<<set $currentMissionEffects = {
corruption: random(2,4),
sexFame: 4,
righteousreputation: -2,
logTitle: "Mission Dominance",
logDesc: "You took control of a junior during a patrol, asserting your authority."
}>>
<<set $missionDominance = "dom">>
<<set _partner = $juniorNPC>>
<<set $sexType = "mission_sex">>
<<set $sexReturnPassage = $missionpassage>>
<<goto "EncounterInteractionSex">>
<</nobr>>
<</widget>>
<<widget "PatrolPerimeter01Neutral">>
<<nobr>>
<<set $missionpassage = $args[0] ?? $passage>>
/* Mission‑specific effects */
<<set $currentMissionEffects = {
corruption: random(2,4),
sexFame: 4,
righteousreputation: -2,
logTitle: "Mission Indulgence",
logDesc: "You shared an intimate moment with a junior during a patrol."
}>>
<<set $missionDominance = "neutral">>
<<set _partner = $juniorNPC>>
<<set $sexType = "mission_sex">>
<<set $sexReturnPassage = $missionpassage>>
<<goto "EncounterInteractionSex">>
<</nobr>>
<</widget>><!-- ═════════════════════════════════════════════════════════════
ADVANCEMENT CHECK WIDGET
Checks if player can advance to next rank
═════════════════════════════════════════════════════════════ -->
<<widget "CheckRankAdvancement">>
/* $args[0]: rank to check */
<<set _rankToCheck to $args[0]>>
<<set _canAdvance to false>>
<<if _rankToCheck eq "Initiate">>
<<set _canAdvance to $ContributionPoints >= 50 and $CurrentPcSectReputation >= 10 and $sectFavor >= 5>>
<<elseif _rankToCheck eq "Disciple">>
<<set _canAdvance to $ContributionPoints >= 150 and $CurrentPcSectReputation >= 30 and $sectFavor >= 15>>
<<elseif _rankToCheck eq "Inner Disciple">>
<<set _canAdvance to $ContributionPoints >= 300 and $CurrentPcSectReputation >= 60 and $sectFavor >= 30>>
<<elseif _rankToCheck eq "Core Disciple">>
<<set _canAdvance to $ContributionPoints >= 600 and $CurrentPcSectReputation >= 100 and $sectFavor >= 50>>
<</if>>
<<print _canAdvance>>
<</widget>><<widget "TournamentArenaSurvival">>
<script>
(function() {
var GRID = 12;
var NPC_TEMPLATES = [
{ name:"Lustful Sword Sister", tag:"sword_sister", color:"#ff69b4", desc:"curvaceous sword cultivator", icon:"⚔️", shortTag:"SS", atk:14, hpBase:70, robeDmgChance:0.0 },
{ name:"Brute Yang Cultivator", tag:"yang_brute", color:"#ff4500", desc:"muscular bare-chested fighter", icon:"💪", shortTag:"YB", atk:18, hpBase:90, robeDmgChance:0.1 },
{ name:"Slippery Fox Spirit", tag:"fox_spirit", color:"#ba55d3", desc:"seductive fox-eared beauty", icon:"🦊", shortTag:"FS", atk:12, hpBase:65, robeDmgChance:0.4 },
{ name:"Cold Yin Beauty", tag:"yin_beauty", color:"#00bfff", desc:"ice-cold elegant lady", icon:"❄️", shortTag:"YN", atk:13, hpBase:68, robeDmgChance:0.0 },
{ name:"Frenzied Dual Cultivator",tag:"dual_cult", color:"#ff1493", desc:"shameless hedonist", icon:"💃", shortTag:"DC", atk:15, hpBase:72, robeDmgChance:0.2 },
{ name:"Shadow Phantom Dancer", tag:"phantom", color:"#9370db", desc:"elusive shadow-step assassin", icon:"🌑", shortTag:"PH", atk:20, hpBase:55, robeDmgChance:0.6 },
{ name:"Wild Beast Tamer", tag:"beast_tamer", color:"#8b4513", desc:"feral warrior bonded with spirits", icon:"🐯", shortTag:"BT", atk:16, hpBase:80, robeDmgChance:0.1 },
{ name:"Heavenly Thunder Monk", tag:"thunder_monk", color:"#f0e040", desc:"shaven-headed lightning cultivator", icon:"⚡", shortTag:"TM", atk:17, hpBase:85, robeDmgChance:0.0 },
{ name:"Poison Lotus Maiden", tag:"poison_lotus", color:"#7fff00", desc:"slender beauty concealing lethal toxins",icon:"🌸", shortTag:"PL", atk:11, hpBase:60, robeDmgChance:0.3 },
{ name:"Drunk Sword Saint", tag:"drunk_saint", color:"#d2691e", desc:"swaying master whose chaos hides genius",icon:"🍶", shortTag:"DS", atk:22, hpBase:75, robeDmgChance:0.0 }
];
if (!window.AR) window.AR = {};
var A = window.AR;
// Fallback defaults
if (!A.safeZone) A.safeZone = { minX:0, maxX:GRID-1, minY:0, maxY:GRID-1 };
if (A.shrinkTimer === undefined) A.shrinkTimer = 25;
function rnd(min, max) { return min + Math.random() * (max - min); }
function dist(ax,ay,bx,by) { return Math.abs(ax-bx)+Math.abs(ay-by); }
function log(msg) {
if (!A.events) A.events = [];
A.events.unshift(msg);
if (A.events.length > 8) A.events.pop();
var el = document.getElementById("ar-log");
if (!el) return;
el.innerHTML = A.events
.map(function(e){ return '<p style="margin:2px 0;color:#bbb;font-size:0.85em;">'+e+'</p>'; })
.join('');
}
function damageRobe(amount) {
var sv = SugarCube.State.variables;
if (!sv.equippedRobe || sv.equippedRobe.durability === undefined) return;
var old = sv.equippedRobe.durability;
sv.equippedRobe.durability = Math.max(0, old - amount);
var lost = old - sv.equippedRobe.durability;
if (lost > 0) {
log("Your robe is torn! Durability: " + sv.equippedRobe.durability);
}
}
function initArena() {
if (A.grid) return;
A.timeLeft = 180;
A.tickCount = 0;
A.isRunning = true;
A.events = [];
A.safeZone = { minX:0, maxX:GRID-1, minY:0, maxY:GRID-1 };
A.shrinkTimer = 25;
A.grid = [];
for (var r=0;r<GRID;r++){A.grid[r]=[];for(var c=0;c<GRID;c++)A.grid[r][c]=null;}
var sv = SugarCube.State.variables;
A.player = {
x:6, y:6,
health: Math.max(10, +(sv.health || 100)),
energy: Math.max(10, +(sv.energy || 100)),
kills:0
};
A.grid[6][6] = "player";
A.npcs = [];
var taken = {"6,6":true};
for (var i=0;i<12;i++){
var tpl = NPC_TEMPLATES[Math.floor(Math.random()*NPC_TEMPLATES.length)];
var x,y,key,tries=0;
do { x=Math.floor(Math.random()*GRID); y=Math.floor(Math.random()*GRID); key=x+","+y; tries++; }
while (taken[key] && tries<40);
if(tries>=40) continue;
taken[key]=true;
A.npcs.push({
id:i, tag:tpl.tag, name:tpl.name+"#"+(i+1),
baseName:tpl.name, short:tpl.shortTag, icon:tpl.icon,
color:tpl.color, desc:tpl.desc,
x:x, y:y, hp:tpl.hpBase+rnd(0,20), maxHp:tpl.hpBase+20,
atk:tpl.atk+rnd(-3,3), isAlive:true, kills:0,
robeDmgChance: tpl.robeDmgChance
});
A.grid[y][x]="npc_"+i;
}
log("Arena begins — "+A.npcs.length+" combatants!");
}
function render() {
var arEl = document.getElementById("ar-grid");
if (!arEl) return;
var sz = A.safeZone || { minX:0, maxX:GRID-1, minY:0, maxY:GRID-1 };
var html = "";
for (var row=0;row<GRID;row++){
for (var col=0;col<GRID;col++){
var cell = A.grid[row][col];
var bg="#1a1a1a", content="·", color="#444", ttl="", border="1px solid #2a2a2a";
if (col < sz.minX || col > sz.maxX || row < sz.minY || row > sz.maxY) {
bg="#330000"; border="1px solid #600";
}
if (cell==="player") {
bg="#1e3a5f"; content="🟦"; ttl="You"; border="1px solid #4af";
} else if (cell && cell.indexOf("npc_")===0) {
var idx=parseInt(cell.split("_")[1],10);
var n=A.npcs[idx];
if (n && n.isAlive && n.hp>0) {
bg=n.color; content=n.short; color="#000";
ttl=n.name+" HP:"+Math.ceil(n.hp); border="1px solid #fff3";
} else {
bg="#1a1a1a"; content="☠"; color="#555";
}
}
html+='<div onclick="AR_click('+col+','+row+')" title="'+ttl+'" '
+'style="width:38px;height:38px;display:flex;align-items:center;justify-content:center;'
+'font-size:12px;font-weight:bold;cursor:pointer;user-select:none;'
+'background:'+bg+';color:'+color+';border:'+border+';">'+content+'</div>';
}
}
arEl.innerHTML = html;
var alive = A.npcs.filter(function(n){return n.isAlive&&n.hp>0;}).length;
var hpEl = document.getElementById("ar-health");
var enEl = document.getElementById("ar-energy");
var tm = document.getElementById("ar-time");
var kl = document.getElementById("ar-kills");
var al = document.getElementById("ar-alive");
var sh = document.getElementById("ar-shrink");
if(hpEl) hpEl.textContent = Math.max(0,Math.floor(A.player.health));
if(enEl) enEl.textContent = Math.max(0,Math.floor(A.player.energy));
if(tm) tm.textContent = Math.max(0,Math.floor(A.timeLeft));
if(kl) kl.textContent = A.player.kills;
if(al) al.textContent = alive;
if(sh) sh.textContent = Math.ceil(A.shrinkTimer || 0);
}
window.AR_move = function(dx,dy) {
if (!A.isRunning) return;
var nx=A.player.x+dx, ny=A.player.y+dy;
if (nx<0||nx>=GRID||ny<0||ny>=GRID) return;
var cell = A.grid[ny][nx];
if (cell && cell.indexOf("npc_")===0) {
var idx=parseInt(cell.split("_")[1],10);
if (A.npcs[idx]&&A.npcs[idx].isAlive) { triggerQTE(idx, false); return; }
}
A.grid[A.player.y][A.player.x]=null;
A.player.x=nx; A.player.y=ny;
A.grid[ny][nx]="player";
render();
};
window.AR_click = function(x,y) {
if (!A.isRunning) return;
var dx=x-A.player.x, dy=y-A.player.y;
if (Math.abs(dx)>1||Math.abs(dy)>1) return;
var cell=A.grid[y][x];
if (cell&&cell.indexOf("npc_")===0) {
var idx=parseInt(cell.split("_")[1],10);
if (A.npcs[idx]&&A.npcs[idx].isAlive) triggerQTE(idx, false);
} else if (!(dx===0&&dy===0)) {
AR_move(dx,dy);
}
};
window.AR_technique = function() {
if (!A.isRunning) return;
if (A.player.energy < 15) { log("Not enough Energy!"); return; }
A.player.energy -= 15;
var hits=0;
A.npcs.forEach(function(n){
if (n.isAlive && dist(n.x,n.y,A.player.x,A.player.y)<=2) {
n.hp-=35; hits++;
if (n.hp<=0){ n.isAlive=false; A.player.kills++; }
}
});
log("Technique released! Hit "+hits+" opponents.");
render();
};
function startTick() {
if (A.tickInterval) { clearInterval(A.tickInterval); A.tickInterval = null; }
A.lastTick = Date.now();
A.tickInterval = setInterval(function(){
try {
if (!A.isRunning) return;
if (!document.getElementById("ar-grid")) {
clearInterval(A.tickInterval);
A.tickInterval = null;
A.isRunning = false;
return;
}
var now = Date.now();
var delta = (now - A.lastTick) / 1000;
A.lastTick = now;
A.timeLeft -= delta;
A.tickCount += 1;
// Check win condition (all enemies dead)
var aliveCount = A.npcs.filter(function(n){return n.isAlive&&n.hp>0;}).length;
if (aliveCount === 0) {
endArena(true); // win
return;
}
if (A.timeLeft <= 0) {
endArena(false); // time up -> lose
return;
}
// ========== Shrink Arena ==========
A.shrinkTimer -= delta;
if (A.shrinkTimer <= 0) {
A.shrinkTimer = 25;
var sz = A.safeZone || { minX:0, maxX:GRID-1, minY:0, maxY:GRID-1 };
if (sz.minX < sz.maxX) { sz.minX++; sz.maxX--; }
if (sz.minY < sz.maxY) { sz.minY++; sz.maxY--; }
A.safeZone = sz;
log("The arena walls close in! Zone shrinks.");
}
// Damage to anyone outside the safe zone
var sz = A.safeZone || { minX:0, maxX:GRID-1, minY:0, maxY:GRID-1 };
if (A.player.x < sz.minX || A.player.x > sz.maxX ||
A.player.y < sz.minY || A.player.y > sz.maxY) {
A.player.health -= 10 * delta;
if (A.player.health <= 0) { A.player.health = 0; endArena(false); return; }
}
A.npcs.forEach(function(n) {
if (!n.isAlive || n.hp <= 0) return;
if (n.x < sz.minX || n.x > sz.maxX || n.y < sz.minY || n.y > sz.maxY) {
n.hp -= 10 * delta;
if (n.hp <= 0) { n.isAlive = false; A.player.kills++; log(n.short+" died outside the zone."); }
}
});
// --- Movement ---
var g=[];
for(var r=0;r<GRID;r++){g[r]=[];for(var c=0;c<GRID;c++)g[r][c]=null;}
g[A.player.y][A.player.x]="player";
for (var i=0;i<A.npcs.length;i++){
var npc=A.npcs[i];
if (!npc.isAlive || npc.hp<=0) continue;
var tgt = findTarget(npc);
if (tgt) {
var dx=tgt.x-npc.x, dy=tgt.y-npc.y;
var mx=0, my=0;
if (Math.abs(dx)>Math.abs(dy)) mx=Math.sign(dx); else my=Math.sign(dy);
var nx2=Math.max(0,Math.min(GRID-1,npc.x+mx));
var ny2=Math.max(0,Math.min(GRID-1,npc.y+my));
if (!g[ny2][nx2]) { npc.x=nx2; npc.y=ny2; }
}
// Check adjacency to player -> QTE with first strike
if (dist(npc.x,npc.y,A.player.x,A.player.y)===1) {
if (!g[npc.y][npc.x]) g[npc.y][npc.x]="npc_"+i;
A.grid=g; render();
// NPC first strike
var firstStrikeDamage = Math.floor(npc.atk * 0.7);
A.player.health -= firstStrikeDamage;
var robeDamaged = false;
if (Math.random() < (npc.robeDmgChance || 0)) {
damageRobe(5 + Math.floor(Math.random()*10));
robeDamaged = true;
}
log(npc.baseName + " attacks first! -" + firstStrikeDamage + " HP" + (robeDamaged ? " (robe torn!)" : ""));
if (A.player.health <= 0) { A.player.health = 0; endArena(false); return; }
triggerQTE(i, true);
return;
}
if (!g[npc.y][npc.x]) g[npc.y][npc.x]="npc_"+i;
}
// --- NPC vs NPC combat ---
for (var a=0;a<A.npcs.length;a++){
var na=A.npcs[a]; if(!na.isAlive||na.hp<=0) continue;
for (var b=a+1;b<A.npcs.length;b++){
var nb=A.npcs[b]; if(!nb.isAlive||nb.hp<=0) continue;
if (dist(na.x,na.y,nb.x,nb.y)===1){
var ra=Math.random()*20+na.atk, rb=Math.random()*20+nb.atk;
if (ra>rb){ nb.hp-=12; if(nb.hp<=0){nb.isAlive=false;na.kills++;log(na.short+" defeats "+nb.short+"!");}}
else { na.hp-=12; if(na.hp<=0){na.isAlive=false;nb.kills++;log(nb.short+" defeats "+na.short+"!");}}
}
}
}
// Clamp all NPC positions to grid (safety)
A.npcs.forEach(function(n){
if (n.isAlive && n.hp>0) {
n.x = Math.max(0, Math.min(GRID-1, n.x));
n.y = Math.max(0, Math.min(GRID-1, n.y));
}
});
A.grid=g; render();
} catch(e) {
console.error("Arena tick error:", e);
}
}, 1000);
}
function findTarget(npc){
var bestDist = Infinity, best = null;
var dP = dist(npc.x, npc.y, A.player.x, A.player.y);
if (dP < bestDist) { bestDist = dP; best = A.player; }
A.npcs.forEach(function(o){
if (o.id === npc.id || !o.isAlive || o.hp <= 0) return;
var d = dist(npc.x, npc.y, o.x, o.y);
if (d < bestDist) { bestDist = d; best = o; }
});
return best;
}
window.triggerQTE = function(idx, firstStrike){
var npc=A.npcs[idx];
if(!npc||!npc.isAlive||npc.hp<=0) return;
A.isRunning=false;
if(A.tickInterval){ clearInterval(A.tickInterval); A.tickInterval=null; }
SugarCube.State.variables.qteNpc = {
id:npc.id, idx:idx, tag:npc.tag,
name:npc.name, baseName:npc.baseName,
desc:npc.desc, color:npc.color,
hp:Math.ceil(npc.hp), icon:npc.icon,
firstStrike: firstStrike || false
};
SugarCube.Engine.play("ArenaSurvivalQTE");
};
window.AR_qteResult = function(success){
var sv = SugarCube.State.variables;
var npc = A.npcs[sv.qteNpc.idx];
if (!npc) return;
if (success){
A.player.energy -= 8;
npc.hp -= 35;
if (npc.hp<=0){ npc.isAlive=false; A.player.kills++; log("You defeated "+npc.baseName+"!"); }
else { log(npc.baseName+" staggers back..."); }
} else {
A.player.health -= 15;
log(npc.baseName+" lands a solid hit on you! -15 HP");
if (Math.random() < (npc.robeDmgChance || 0)) {
damageRobe(10 + Math.floor(Math.random()*15));
}
}
sv.health = Math.max(0, Math.floor(A.player.health));
sv.energy = Math.max(0, Math.floor(A.player.energy));
A.isRunning = true;
if (A.player.health <= 0) { endArena(false); return; }
render();
startTick();
};
window.endArena = function(victory){
if (A.isRunning === false && A.grid) return; // already ended
A.isRunning=false;
if(A.tickInterval){ clearInterval(A.tickInterval); A.tickInterval=null; }
var sv = SugarCube.State.variables;
sv.arenaSurvivalKills = A.player.kills;
sv.arenaSurvivalHealth = Math.floor(A.player.health);
sv.arenaSurvivalEnergy = Math.floor(A.player.energy);
sv.health = Math.max(0, Math.floor(A.player.health));
sv.energy = Math.max(0, Math.floor(A.player.energy));
log("Arena over!");
if (victory) {
SugarCube.Engine.play("ArenaSurvivalVictory");
} else {
SugarCube.Engine.play("ArenaSurvivalDefeat");
}
};
// Cleanup when leaving the passage
$(document).on(":passageend", function () {
if (!document.getElementById("ar-grid")) {
if (A.tickInterval) {
clearInterval(A.tickInterval);
A.tickInterval = null;
A.isRunning = false;
}
}
});
// On display: either resume existing state or initialise fresh
$(document).on(":passagedisplay", function(){
if (document.getElementById("ar-grid")) {
if (A.grid) {
A.isRunning = true;
render();
startTick();
} else {
initArena();
render();
startTick();
}
}
});
})();
</script>
<!-- ═══ LAYOUT ═══════════════════════════════════════════════════════════════ -->
<<nobr>>
<div style="display:flex;gap:12px;align-items:flex-start;font-family:monospace;">
<div>
<div id="ar-grid"
style="display:grid;grid-template-columns:repeat(12,38px);
gap:1px;background:#111;padding:6px;border:1px solid #333;">
</div>
<div style="display:grid;grid-template-columns:repeat(3,40px);
grid-template-rows:repeat(3,40px);gap:3px;margin-top:8px;">
<div></div>
<button onclick="AR_move(0,-1)"
style="background:#222;color:#fff;border:1px solid #555;cursor:pointer;font-size:18px;">↑</button>
<div></div>
<button onclick="AR_move(-1,0)"
style="background:#222;color:#fff;border:1px solid #555;cursor:pointer;font-size:18px;">←</button>
<div style="background:#333;border:1px solid #444;"></div>
<button onclick="AR_move(1,0)"
style="background:#222;color:#fff;border:1px solid #555;cursor:pointer;font-size:18px;">→</button>
<div></div>
<button onclick="AR_move(0,1)"
style="background:#222;color:#fff;border:1px solid #555;cursor:pointer;font-size:18px;">↓</button>
<div></div>
</div>
<button onclick="AR_technique()"
style="margin-top:8px;width:124px;padding:6px;background:#3a1a3a;
color:#f8f;border:1px solid #a0a;cursor:pointer;font-size:0.85em;">
✨ Technique (15 Energy)
</button>
</div>
<!-- RIGHT: Stats + log -->
<div style="min-width:180px;">
<div style="background:#111;border:1px solid #333;padding:8px;margin-bottom:8px;font-size:0.85em;">
<p style="margin:2px 0;">❤️ Health: <strong id="ar-health">100</strong></p>
<p style="margin:2px 0;">💠 Energy: <strong id="ar-energy">100</strong></p>
<p style="margin:2px 0;">⏱ Time: <strong id="ar-time">180</strong></p>
<p style="margin:2px 0;">⚔ Kills: <strong id="ar-kills">0</strong></p>
<p style="margin:2px 0;">👥 Alive: <strong id="ar-alive">12</strong></p>
<p style="margin:2px 0;">🌀 Zone shrinks in <strong id="ar-shrink">25</strong>s</p>
</div>
<div id="ar-log"
style="background:#0e0e0e;border:1px solid #333;padding:8px;
height:220px;overflow-y:auto;">
</div>
</div>
</div>
<</nobr>>
<</widget>><<set _n to $qteNpc>>
<div style="max-width:520px;margin:0 auto;font-family:Georgia,serif;">
<div style="display:flex;align-items:center;gap:14px;margin-bottom:14px;">
<div style="width:80px;height:80px;background:<<print _n.color>>;border-radius:8px;
display:flex;align-items:center;justify-content:center;font-size:38px;flex-shrink:0;">
<<print _n.icon>>
</div>
<div>
<p style="margin:0;font-size:1.1em;font-weight:bold;"><<print _n.baseName>></p>
<p style="margin:3px 0 0;font-size:0.85em;color:#aaa;"><<print _n.desc>></p>
<p style="margin:4px 0 0;font-size:0.8em;">HP: <strong><<print _n.hp>></strong></p>
</div>
</div>
<div style="background:#0e0e0e;border-left:3px solid <<print _n.color>>;padding:10px 14px;margin-bottom:14px;line-height:1.7;">
<<switch _n.tag>>
<<case "sword_sister">>
<p>She closes the gap in three swift steps, her blade arm sweeping wide — then, deliberately, it's her free hand that reaches you first. Fingers curl around your collar and yank you forward, close enough that her breath hits your cheek. Your backs are against each other; you feel every curve pressing warm and insistent through her torn silk robe.</p>
<p style="color:#ccc;font-size:0.9em;">"I didn't come here just to fight," she murmurs, lips brushing your ear.</p>
<<case "yang_brute">>
<p>He doesn't strike — he <em>grabs</em>. One enormous hand seizes your wrist, the other clamps around your waist and lifts. You're pulled flush against his sweat-slicked chest, his qi radiating like a furnace against your skin. You can feel his heartbeat against you, wild and fast.</p>
<p style="color:#ccc;font-size:0.9em;">"Still want to test me?" he growls, grip tightening.</p>
<<case "fox_spirit">>
<p>She slides behind you with fox-spirit stealth, arms winding around your torso from the back before you can turn. Her claws find the hem of your outer robe and tug it off your shoulder in one smooth motion, baring skin to the arena air. Her chin rests on your shoulder, her breath warm against your neck.</p>
<p style="color:#ccc;font-size:0.9em;">"Got you," she whispers, tail curling around your leg.</p>
<<case "yin_beauty">>
<p>She presses both palms flat to your chest — cold as winter stone — and backs you against an invisible wall of compressed yin qi. The force pins you in place. She steps closer, eyes level with yours, her white hair brushing your face as she leans in to study your reaction.</p>
<p style="color:#ccc;font-size:0.9em;">"You cannot run from cold," she says softly. "And cold always… eventually… burns."</p>
<<case "dual_cult">>
<p>She collides with you shoulder-first, momentum carrying you both sideways. You catch her — instinctively — and end up with one arm around her back, her thigh hooking over your hip as she rights herself. She doesn't pull away. She makes it worse, grabbing your free hand and pressing it to her waist.</p>
<p style="color:#ccc;font-size:0.9em;">"Oh, don't apologise," she laughs breathlessly. "I planned that."</p>
<<case "phantom">>
<p>You never see her move. Suddenly there's a forearm across your throat from behind, pressing — firm but not crushing. Shadow qi bleeds cold into your spine. Her lips graze the back of your neck. Your outer robe's sash is already gone; you don't know when she took it.</p>
<p style="color:#ccc;font-size:0.9em;">"You breathe too loud," she whispers. "I could have done this ten steps ago."</p>
<<case "beast_tamer">>
<p>He tackles you in a full-body impact, and the two of you roll across the arena stone in a tangle of limbs. He ends up on top, knees pinning your thighs, one hand pressing your wrist above your head. His wild eyes search yours — part threat, part something else.</p>
<p style="color:#ccc;font-size:0.9em;">"Beast qi calls to beast qi," he rumbles. "You feel it too."</p>
<<case "thunder_monk">>
<p>Lightning-fast he grabs your forearm; the jolt of his thunder qi makes every hair on your body stand. He reels you in with the hold, spins you, and your back collides with his chest. His robes smell of ozone and incense. A second hand presses firm against your sternum, holding you there.</p>
<p style="color:#ccc;font-size:0.9em;">"The lightning does not lie," he intones. "Nor does this heartbeat."</p>
<<case "poison_lotus">>
<p>She extends one finger and drags it down your forearm — light as a feather, leaving a faint red line where her toxin grazes. Not injected. Just… marked. She circles you slowly, the hem of her qipao whispering against the stone, her eyes never leaving yours.</p>
<p style="color:#ccc;font-size:0.9em;">"I can make it hurt," she murmurs, "or I can make it feel entirely different. Your choice."</p>
<<case "drunk_saint">>
<p>He staggers into you deliberately — you know it's deliberate because the gourd of wine stays perfectly level throughout — and suddenly his arm is slung around your neck, heavy and warm. His face is too close, grinning, flushed. His free hand flicks open your collar button. Just the one. Then he blinks at you innocently.</p>
<p style="color:#ccc;font-size:0.9em;">"Oops," he says, not even slightly sorry.</p>
<<default>>
<p>They close the distance fast, grabbing your arm and twisting you against them. The contact is rough, purposeful — and prolonged.</p>
<</switch>>
<<if _n.firstStrike>>
<p style="color:#ff6666;margin-top:8px;"><em>They struck you before you could react! You're already hurt.</em></p>
<</if>>
</div>
<p style="color:#ffcc00;font-weight:bold;margin-bottom:10px;">⚡ What do you do?</p>
<div style="display:flex;flex-direction:column;gap:8px;">
<<link "⚔️ Break the grip — force them back">>
<<set $qteChoice to "break">>
<<goto "ArenaSurvivalQTEResolution">>
<</link>>
<<link "🤝 Use their closeness — redirect their momentum">>
<<set $qteChoice to "redirect">>
<<goto "ArenaSurvivalQTEResolution">>
<</link>>
<<link "💋 Press closer — turn the contact into your weapon">>
<<set $qteChoice to "intimate">>
<<goto "ArenaSurvivalQTEResolution">>
<</link>>
<<link "🔥 Take control — grab them before they can react">>
<<set $qteChoice to "dominate">>
<<goto "ArenaSurvivalQTEResolution">>
<</link>>
</div>
</div><<set _n to $qteNpc>>
<<set _choice to $qteChoice>>
<div style="max-width:520px;margin:0 auto;font-family:Georgia,serif;">
<<switch _choice>>
<<case "break">>
<h3 style="color:#4af;">⚔️ You wrench free and strike!</h3>
<<switch _n.tag>>
<<case "sword_sister">>
<p>You grab her wrist, twist inward, and shove. Her grip tears away; her sleeve rips at the shoulder with a sharp sound, baring her arm to the elbow. She spins from the momentum and you're on her before she recovers — elbow to her ribs, hard. She hits the dust on one knee, gasping.</p>
<p style="color:#ccc;">"You tore my robe!" she snarls, half-outraged, half something she's fighting not to show.</p>
<<case "yang_brute">>
<p>You plant your feet, drop your weight, and heave upward against his grip. His sash comes loose in your fist; he stumbles back a full step — which for him is a miracle. You follow immediately, driving your shoulder into his gut. Even he grunts at that.</p>
<p style="color:#ccc;">"HA! Now we're talking!" he roars, actually grinning through the pain.</p>
<<case "fox_spirit">>
<p>You spin into the grab, and her own arms tangle around herself. Her outer robe slips off entirely as she's forced to release you — she catches it, but barely, clutching it to her chest as she lands in a crouch, tail frizzed with surprise.</p>
<p style="color:#ccc;">"You BEAST," she hisses, eyes gleaming.</p>
<<case "yin_beauty">>
<p>You channel your qi into your palms and push outward, shattering her yin wall. The cold shatters like glass, and she staggers, frost spreading across her own hands from the rebound. A rare crack runs through her composure.</p>
<p style="color:#ccc;">"Unexpected," she admits, voice tight, cheeks faintly flushed.</p>
<<case "dual_cult">>
<p>You unhook her leg from your hip and step back smartly, leaving her staggering. Her qipao's side-slit tears as she catches herself — she looks down at it, then back up at you, delighted despite herself.</p>
<p style="color:#ccc;">"Oh, you're interesting," she breathes.</p>
<<default>>
<p>You break the hold with sharp, decisive force. They're thrown back, disoriented. You strike while they recover.</p>
<</switch>>
<p style="color:#4ade80;font-weight:bold;margin-top:12px;">✅ Success — heavy damage dealt!</p>
<<run window.AR_qteResult(true)>>
[[Return to Arena->TournamentBattle|FormatSpecific]]
<<case "redirect">>
<h3 style="color:#f0d060;">🤝 You flow with the contact!</h3>
<<switch _n.tag>>
<<case "sword_sister">>
<p>Instead of pushing away you step into her pull, letting her draw you in — then use that momentum to pivot her over your hip. She goes airborne briefly, lands hard. But your hands are still tangled in the remains of her collar, and you come down half on top of her. The landing is not graceful. The closeness is.</p>
<<case "yang_brute">>
<p>You go limp for one heartbeat — his grip expects resistance, gets none. You slide through, use his own yanking motion to swing around his back. Your arm hooks around his thick neck from behind, and you hang off him until he drops to one knee from the choke angle.</p>
<<case "fox_spirit">>
<p>You reach back, grab her arms where they're clasped around you, and use them as a fulcrum — throwing her over your shoulder. She flips neatly, lands on her feet, but her robe didn't quite make the rotation. She catches it, laughing even as she bleeds from a graze on her side.</p>
<<case "yin_beauty">>
<p>You press your palms over her pinning hands and gently push sideways rather than outward. Yin qi redirects. She spins on her own axis, confused, and you step smoothly behind her, one arm across her collarbone, holding her from the back until she stills.</p>
<p style="color:#ccc;">"Let go," she whispers, but doesn't activate her qi to enforce it.</p>
<<case "beast_tamer">>
<p>You don't fight the pin — you bridge your hips upward, roll, and suddenly the top-bottom is reversed. You're kneeling over him now. He blinks up at you, chest heaving. Then he starts to smile.</p>
<<default>>
<p>You redirect their energy back on them, using their own momentum to land a clean, efficient strike. They reel, disoriented.</p>
<</switch>>
<p style="color:#ffd700;font-weight:bold;margin-top:12px;">✅ Partial success — moderate damage, advantageous position!</p>
<<run window.AR_qteResult(true)>>
[[Return to Arena->TournamentBattle|FormatSpecific]]
<<case "intimate">>
<h3 style="color:#ff69b4;">💋 You lean in...</h3>
<<switch _n.tag>>
<<case "sword_sister">>
<p>You don't pull away from her grip on your collar. You step into it, deliberately closing the last inch. Your free hand settles on her hip, and you hold her gaze. For one suspended moment she forgets to swing. Her lips part. Your knee finds her inner thigh and sweeps her footing away.</p>
<p style="color:#ccc;">She hits the ground looking dazed and flushed and furious in equal measure.</p>
<<case "yang_brute">>
<p>You go still in his crushing grip — then tilt your head back against his chest and look up at him. "Not yet," you say quietly. The contradiction in his eyes is immediate: the fighter not knowing what to do with the lack of struggle. His hold loosens by one fraction. Your elbow drives back into his solar plexus.</p>
<<case "fox_spirit">>
<p>You reach up and cover her hand — the one clutching your bared shoulder — with yours, pressing it there. She freezes, sensing a trap but not finding it. You turn just enough to meet her eyes, less than a handspan between your faces. "Your move," you murmur. She bites her lip instead of attacking.</p>
<p>That one-second lapse costs her. Your knee rises sharply into her guard.</p>
<<case "phantom">>
<p>You don't fight the forearm at your throat. You tuck your chin, turn your head, and press your cheek against her arm — holding it there, warm and deliberate. Behind you, you feel her breath catch. The cold shadow-qi stutter. Your foot hooks around her ankle.</p>
<<case "poison_lotus">>
<p>You catch her circling wrist and bring the marked line on your forearm to your lips, eyes on hers. The toxin is superficial — you knew that. She didn't expect you to know. For one extraordinary moment her practiced poise evaporates entirely, and she stares at you with wide, unguarded eyes.</p>
<p>You strike into that gap without hesitation.</p>
<<default>>
<p>You press closer instead of retreating. The unexpected intimacy disrupts their rhythm entirely — the opening you need materialises, and you take it cleanly.</p>
<</switch>>
<p style="color:#ff69b4;font-weight:bold;margin-top:12px;">✅ Success — distraction creates a critical opening!</p>
<<run window.AR_qteResult(true)>>
[[Return to Arena->TournamentBattle|FormatSpecific]]
<<case "dominate">>
<h3 style="color:#ff4444;">🔥 You seize control!</h3>
<<switch _n.tag>>
<<case "sword_sister">>
<p>You grab both her wrists before she can reset her stance, cross them at her chest, and back her against the arena wall. Pinned. Her sword arm is useless at this angle. She looks up at you — breathing hard, lips pressed together, a flush spreading down her neck and past her torn collar.</p>
<p style="color:#ccc;">"Yield," you say.</p>
<p style="color:#ccc;">She doesn't. But it takes her two full seconds to remember why.</p>
<<case "yang_brute">>
<p>You break grip, grab his sash with both hands, and use every ounce of your qi to swing him sideways into the arena stone. The impact reverberates. He slumps to one knee, massive frame shuddering, looking up at you with something that has left "fury" far behind and arrived somewhere rawer.</p>
<p style="color:#ccc;">"You're the first one who's done that to me," he says roughly. "…In a long time."</p>
<<case "fox_spirit">>
<p>You spin her, pin her back against you — arm across her stomach, your grip iron — and growl low: "Stop." Her struggling freezes instantly, every muscle going taut and then, inexplicably, soft. Her ears fold. Her tail curls inward. She makes a very small sound.</p>
<p style="color:#ccc;">"This," she whispers, "is deeply unfair."</p>
<<case "yin_beauty">>
<p>You shatter the rest of her yin wall not with brute force but with focused heat — your palm pressed flat to her sternum, qi burning warm and insistent against her cold. The frost on her skin melts where you touch. She goes absolutely still, eyes wide, the composure she has carried all her life dissolving in your hands.</p>
<p style="color:#ccc;">Her next breath is shaking. "How," she says, "did you break my cold?"</p>
<<case "beast_tamer">>
<p>You seize the fur trim of his collar and drag him down to your eye level. "Enough." He freezes — beast tamer, unaccustomed to being subdued — and something old and instinctual in him responds to the dominance the way any creature would. He stills completely, watching you.</p>
<p style="color:#ccc;">"…Alpha," he says simply, after a long moment.</p>
<<case "drunk_saint">>
<p>You pluck the gourd from his hand — the one thing he'll always track. He follows it instinctively and walks straight into you. You catch him, press his back to your front, and close your hand around his sword wrist. The drunken sway goes rigid with surprise. For once, he has absolutely nothing to say.</p>
<<default>>
<p>You take charge before they can recalibrate — grabbing, gripping, forcing them to react to you instead. The sudden reversal of control staggers them completely.</p>
<</switch>>
<p style="color:#ff4444;font-weight:bold;margin-top:12px;">💥 Critical success — massive damage, total momentary dominance!</p>
<<run window.AR_qteResult(true)>>
[[Return to Arena->TournamentBattle|FormatSpecific]]
<</switch>>
</div><<set _kills to $arenaSurvivalKills ?? 0>>
<<set _health to $arenaSurvivalHealth ?? 0>>
<<getArenaSurvivalVictory>>
<p>The last opponent falls and the crowd erupts. Dust and spent qi hang in the air.</p>
<p>You stand alone amidst the fallen, breathing hard. Your robes are torn, your body battered — but you are victorious.</p>
<p style="color:#ffd700;">Enemies defeated: <strong><<print _kills>></strong></p>
<p style="color:#4ade80;">Health remaining: <strong><<print _health>></strong></p>
<p>The tournament officials approach with your prize — a jade token of survival, and the adoration of every onlooker.</p>
<<link "Celebrate Your Victory" $city>>
<<set $pe to 0>>
<</link>><<set _kills to $arenaSurvivalKills ?? 0>>
<<getArenaSurvivalDefeat>>
<<if $health lte 0>>
<p>A final blow sends you crashing to the stone floor. Your vision swims and the roar of the crowd fades to a distant murmur.</p>
<<else>>
<p>The horn sounds — time has run out. You are surrounded by enemies still standing, and the marshals pull you from the arena floor.</p>
<</if>>
<p>You wake in the medical tent, bandaged and sore. At least you are alive… but the shame burns hotter than any wound.</p>
<p style="color:#aaa;">You managed to eliminate <<print _kills>> opponents before falling.</p>
<<link "I will come back next time... stronger.." $city>>
<<set $pe to 0>>
<</link>><<widget "HeavenlyStairChallenge">>
<<nobr>>
<<silently>>
<<if !$hsPhase>>
<<set $hsPhase to "pre">>
<<set $hsPreNPCs to []>>
<<set $hsPostNPCs to []>>
<<set $hsPlayerStep to 0>>
<<set $hsCurrentStep to 1>>
<<set $hsPlayerActive to false>>
<<set _preCount to random(4,6)>>
<<for _i to 0; _i lt _preCount; _i++>>
<<set _name to ["Iron Body Lu","Swift Sword Mei","Azure Pill Elder","Shadow Step Fang","Crimson Mantis","Jade Grace","Thunder Hand Wei","Silent Viper"].random() + " (Rank "+(_i+1)+")">>
<<set _steps to random(12, 38)>>
<<set $hsPreNPCs.push({name: _name, steps: _steps})>>
<</for>>
<<set $hsPreNPCs.sort(function(a,b){ return b.steps - a.steps; })>>
<</if>>
<</silently>>
<div style="max-width:600px;margin:0 auto;font-family:Georgia,serif;">
<h2>🏔️ Heavenly Stair Challenge</h2>
<p>An ancient formation manifests a staircase reaching toward the heavens. Each step places greater pressure upon the body, mind, and soul.</p>
<<if $hsPhase eq "pre">>
<h3>Earlier Climbers</h3>
<<if $hsPreNPCs.length>>
<ol>
<<for _npc range $hsPreNPCs>>
<li><strong><<print _npc.name>></strong> — <<print _npc.steps>> steps</li>
<</for>>
</ol>
<<else>>
<p>No one has dared to climb before you.</p>
<</if>>
<p style="margin-top:1.5em;">The current highest is <strong><<print Math.max.apply(null, $hsPreNPCs.map(function(n){return n.steps;}).concat(0))>></strong> steps.</p>
<<link "🦶 Begin Your Ascent">>
<<set $hsPhase to "climb">>
<<set $hsPlayerActive to true>>
<<set $hsCurrentStep to 1>>
<<set $health to $health>>
<<set $energy to $energy>>
<<goto "HeavenlyStairStep">>
<</link>>
<<elseif $hsPhase eq "results">>
<<goto "HeavenlyStairResults">>
<</if>>
</div>
<</nobr>>
<</widget>><<silently>>
<<set _step to $hsCurrentStep>>
<<set _diff to Math.floor(_step * 1.6) + random(-3,3)>>
<<set $hsCurrentDiff to _diff>> <!-- store for resolver -->
<<set _challengeType to ["body","mind","soul"].random()>>
<<set _health to $health>>
<<set _energy to $energy>>
<</silently>>
<div style="max-width:550px;margin:0 auto;font-family:Georgia,serif;">
<h2>Step <<print _step>></h2>
<<if _challengeType eq "body">>
<p>The air thickens into a crushing weight, pressing down on your shoulders. Your muscles scream as gravity multiplies – it feels like carrying a mountain on your back.</p>
<<elseif _challengeType eq "mind">>
<p>A thousand whispers assault your concentration. Visions of past failures, future doubts, and hidden fears swirl around you like an invisible storm. Your mind trembles on the edge of chaos.</p>
<<elseif _challengeType eq "soul">>
<p>Your very essence quivers under the celestial weight. The staircase seems to pierce your dantian, probing your spirit with an ancient, indifferent force. Your soul feels naked before the heavens.</p>
<</if>>
<p><strong>Difficulty:</strong> <<print _diff>></p>
<p>❤️ Health: <<print _health>> | 💠 Energy: <<print _energy>></p>
<<if _health <= 0 or _energy <= 0>>
<p style="color:#ff4444;">Your body fails you. You collapse on step <<print _step>>, unable to continue.</p>
<<set $hsPlayerStep to _step - 1>>
<<set $hsPhase to "post">>
<<set $hsPlayerActive to false>>
<<set $health to Math.max(0, _health)>>
<<set $energy to Math.max(0, _energy)>>
<<goto "HeavenlyStairResults">>
<</if>>
<p>How do you endure?</p>
<div style="display:flex;flex-direction:column;gap:8px;">
<<link "💪 Body (Martial Arts)">>
<<set $hsChosenStat to "body">>
<<goto "HeavenlyStairStepResolver">>
<</link>>
<<link "🧠 Mind (Willpower)">>
<<set $hsChosenStat to "mind">>
<<goto "HeavenlyStairStepResolver">>
<</link>>
<<link "✨ Soul (Spiritual Root)">>
<<set $hsChosenStat to "soul">>
<<goto "HeavenlyStairStepResolver">>
<</link>>
</div>
<p style="margin-top:1.5em;">
<<link "⚠️ Voluntarily Stop Climbing">>
<<set $hsPlayerStep to $hsCurrentStep - 1>>
<<set $hsPhase to "post">>
<<set $hsPlayerActive to false>>
<<set $health to Math.max(0, $health)>>
<<set $energy to Math.max(0, $energy)>>
<<goto "HeavenlyStairResults">>
<</link>>
</p>
</div><<silently>>
<<set _step to $hsCurrentStep>>
<<set _diff to $hsCurrentDiff>>
<<set _stat to 0>>
<<if $hsChosenStat eq "body">>
<<set _stat to $martialArts>>
<<elseif $hsChosenStat eq "mind">>
<<set _stat to $willpower>>
<<elseif $hsChosenStat eq "soul">>
<<set _stat to $spiritualRoot>>
<</if>>
<<if _stat >= _diff>>
<<set $health -= 5 + Math.floor(_step/5)>>
<<set $energy -= 3>>
<<set $hsCurrentStep += 1>>
<<set _message to "success">>
<<else>>
<<set $health -= 10 + Math.floor(_step/3)>>
<<set $energy -= 5>>
<<set _message to "failure">>
<</if>>
<</silently>>
<div style="max-width:550px;margin:0 auto;font-family:Georgia,serif;">
<<if _message eq "success">>
<<if $hsChosenStat eq "body">>
<p style="color:#4ade80;">You power through with sheer physical might!</p>
<<elseif $hsChosenStat eq "mind">>
<p style="color:#4ade80;">Your iron focus silences the chaos.</p>
<<else>>
<p style="color:#4ade80;">Your soul harmonises with the stair's rhythm.</p>
<</if>>
<<else>>
<<if $hsChosenStat eq "body">>
<p style="color:#f88;">Your body gives way under the strain.</p>
<<elseif $hsChosenStat eq "mind">>
<p style="color:#f88;">Your mind fractures under the assault.</p>
<<else>>
<p style="color:#f88;">Your spirit trembles on the edge of dissolution.</p>
<</if>>
<</if>>
<<if $health <= 0 or $energy <= 0>>
<p style="color:#ff4444;">You cannot go on. You collapse on the stairs.</p>
<<set $hsPlayerStep to $hsCurrentStep - 1>>
<<set $hsPhase to "post">>
<<set $hsPlayerActive to false>>
<<set $health to Math.max(0, $health)>>
<<set $energy to Math.max(0, $energy)>>
<<goto "HeavenlyStairResults">>
<<else>>
<<link "Next Step">>
<<goto "HeavenlyStairStep">>
<</link>>
<</if>>
</div><<silently>>
/* Generate post‑climbers (2‑4 NPCs) */
<<set _postCount to random(2,4)>>
<<set $hsPostNPCs to []>>
<<for _i to 0; _i lt _postCount; _i++>>
<<set _name to ["Golden Lion Peng","Silent Reaper Xu","Jade Serpent Li","Cyclone Kick Bao","Void Disciple","Blade Devil","Frozen Petal"].random() + " (Finalist)">>
<<set _steps to random(10, 40)>>
<<set $hsPostNPCs.push({name: _name, steps: _steps})>>
<</for>>
/* Combine all climbers for ranking */
<<set _all to []>>
<<for _npc range $hsPreNPCs>>
<<set _all.push(_npc)>>
<</for>>
<<set _all.push({name: "You", steps: $hsPlayerStep})>>
<<for _npc range $hsPostNPCs>>
<<set _all.push(_npc)>>
<</for>>
<<set _all.sort(function(a,b){ return b.steps - a.steps; })>>
<<set $hsPlayerRank to _all.findIndex(function(e){ return e.name === "You"; }) + 1>>
<<set $hsTotalClimbers to _all.length>>
<</silently>>
<div style="max-width:600px;margin:0 auto;font-family:Georgia,serif;">
<<if $hsPlayerRank eq 1>>
<<getHeavenlyStairVictory>>
<<else>>
<<getHeavenlyStairDefeat>>
<</if>>
<h3>Final Rankings</h3>
<ol>
<<for _entry range _all>>
<li><strong><<print _entry.name>></strong>: <<print _entry.steps>> steps<<if _entry.name eq "You">> ⬅️ You<</if>></li>
<</for>>
</ol>
<<link "Return to Tournament" $city>>
<<set $hsPhase to undefined>>
<<set $hsPreNPCs to undefined>>
<<set $hsPostNPCs to undefined>>
<<set $hsPlayerStep to undefined>>
<</link>>
</div><<widget "PillRefiningTournament">>
<<nobr>>
<<silently>>
<<if !$prPhase>>
<<set $prPhase to "pre">>
<<set $prPhaseStep to 1>>
<<set $prScore to 0>>
<<set $prNPCs to []>>
/* Generate 5-8 NPC competitors with random scores */
<<set _npcCount to random(5,8)>>
<<for _i to 0; _i lt _npcCount; _i++>>
<<set _name to ["Azure Pill Elder","Crimson Cauldron Li","Jade Elixir Fairy","Iron Furnace Zhou","Silent Alchemist Wei","Poison Mistress Xue","Golden Pill Monk","Herb Sage Fang"].random() + " (Rank "+(_i+1)+")">>
<<set _score to random(40, 95)>>
<<set $prNPCs.push({name: _name, score: _score})>>
<</for>>
<<set $prNPCs.sort(function(a,b){ return b.score - a.score; })>>
<</if>>
<</silently>>
<div style="max-width:600px;margin:0 auto;font-family:Georgia,serif;">
<h2>⚗️ Pill Refining Tournament</h2>
<p>A row of ancient cauldrons lines the hall. Each competitor must refine a <strong>Spirit Ascension Pill</strong> – the highest quality wins.</p>
<<if $prPhase eq "pre">>
<h3>Registered Alchemists</h3>
<<if $prNPCs.length>>
<ol>
<<for _npc range $prNPCs>>
<li><strong><<print _npc.name>></strong> – estimated skill: <<print _npc.score>></li>
<</for>>
</ol>
<<else>>
<p>No other alchemists registered – you refine unopposed.</p>
<</if>>
<p style="margin-top:1.5em;">You will be judged on your pill's quality. Begin when ready.</p>
<<link "🔥 Light the Cauldron">>
<<set $prPhase to "refine">>
<<set $prPhaseStep to 1>>
<<goto "PillRefiningPhase">>
<</link>>
<<elseif $prPhase eq "results">>
<<goto "PillRefiningResults">>
<</if>>
</div>
<</nobr>>
<</widget>><<silently>>
<<set _step to $prPhaseStep>>
<<set _difficulty to 10 + (_step * 8) + random(-3,3)>>
<<if _step eq 1>>
<<set _title to "Ingredient Preparation">>
<<set _desc to "You must select and process the spirit herbs. One wrong cut and the entire batch is ruined.">>
<<elseif _step eq 2>>
<<set _title to "Flame Control">>
<<set _desc to "The cauldron roars. You must balance the fire – too hot and the essence burns, too cold and it fails to fuse.">>
<<elseif _step eq 3>>
<<set _title to "Pill Condensation">>
<<set _desc to "The final moment. The liquid coalesces into a pill. One mistake now and all previous effort is wasted.">>
<</if>>
<</silently>>
<div style="max-width:550px;margin:0 auto;font-family:Georgia,serif;">
<h2>Phase <<print _step>>: <<print _title>></h2>
<p><<print _desc>></p>
<p><strong>Difficulty:</strong> <<print _difficulty>></p>
<p>How will you proceed?</p>
<div style="display:flex;flex-direction:column;gap:8px;">
<<link "🌿 Spiritual Root – sense the ingredients">>
<<set $prChosenStat to "spiritual">>
<<goto "PillRefiningPhaseResolver">>
<</link>>
<<link "📖 Insight – recall ancient formulas">>
<<set $prChosenStat to "insight">>
<<goto "PillRefiningPhaseResolver">>
<</link>>
<<link "🍀 Luck – trust your instincts">>
<<set $prChosenStat to "luck">>
<<goto "PillRefiningPhaseResolver">>
<</link>>
</div>
</div><<silently>>
<<set _step to $prPhaseStep>>
<<set _difficulty to 10 + (_step * 8) + random(-3,3)>>
<<set _stat to 0>>
<<if $prChosenStat eq "spiritual">>
<<set _stat to $spiritualRoot>>
<<set _statName to "Spiritual Root">>
<<elseif $prChosenStat eq "insight">>
<<set _stat to $insight>>
<<set _statName to "Insight">>
<<elseif $prChosenStat eq "luck">>
<<set _stat to $luck>>
<<set _statName to "Luck">>
<</if>>
<<if _stat >= _difficulty>>
<<set _success to true>>
<<set _phaseScore to 25 + random(0,8)>>
<<set _message to "success">>
<<else>>
<<set _success to false>>
<<set _phaseScore to 10 + random(0,5)>>
<<set _message to "failure">>
<</if>>
<<set $prScore += _phaseScore>>
<</silently>>
<div style="max-width:550px;margin:0 auto;font-family:Georgia,serif;">
<<if _message eq "success">>
<<if $prChosenStat eq "spiritual">>
<p style="color:#4ade80;">Your spiritual senses guide your hands perfectly. The herbs practically leap into the cauldron in the right order.</p>
<<elseif $prChosenStat eq "insight">>
<p style="color:#4ade80;">You recall an ancient scroll. A slight modification to the formula at this stage – brilliant!</p>
<<else>>
<p style="color:#4ade80;">Against all odds, a gamble pays off. The flames dance exactly as you need them to.</p>
<</if>>
<p>You gain <strong><<print _phaseScore>></strong> quality points. (Total: <<print $prScore>>)</p>
<<else>>
<<if $prChosenStat eq "spiritual">>
<p style="color:#f88;">Your spiritual senses waver. You misjudge the herb ratios – the mixture bubbles dangerously.</p>
<<elseif $prChosenStat eq "insight">>
<p style="color:#f88;">A memory lapse. The formula you were certain of turns out incomplete. You barely salvage the step.</p>
<<else>>
<p style="color:#f88;">Your gamble fails. The cauldron shudders and almost cracks, wasting precious essence.</p>
<</if>>
<p>You only add <strong><<print _phaseScore>></strong> quality points. (Total: <<print $prScore>>)</p>
<</if>>
<<set $prPhaseStep += 1>>
<<if $prPhaseStep gt 3>>
<<set $prPhase to "results">>
<<goto "PillRefiningResults">>
<<else>>
<<link "Next Phase">>
<<goto "PillRefiningPhase">>
<</link>>
<</if>>
</div><<silently>>
/* Combine player and NPC scores */
<<set _all to []>>
<<for _npc range $prNPCs>>
<<set _all.push(_npc)>>
<</for>>
<<set _all.push({name: "You", score: $prScore})>>
<<set _all.sort(function(a,b){ return b.score - a.score; })>>
<<set $prPlayerRank to _all.findIndex(function(e){ return e.name === "You"; }) + 1>>
<<set $prTotal to _all.length>>
<</silently>>
<div style="max-width:600px;margin:0 auto;font-family:Georgia,serif;">
<<if $prPlayerRank eq 1>>
<<getPillRefiningVictory>>
<<else>>
<<getPillRefiningDefeat>>
<</if>>
<h3>Final Rankings</h3>
<ol>
<<for _entry range _all>>
<li><strong><<print _entry.name>></strong>: <<print _entry.score>> points<<if _entry.name eq "You">> ⬅️ You<</if>></li>
<</for>>
</ol>
<<link "Return to Tournament" $city>>
<<set $prPhase to undefined>>
<<set $prNPCs to undefined>>
<<set $prScore to undefined>>
<<set $prPlayerRank to undefined>>
<<set $prTotal to undefined>>
<</link>>
</div><<widget "generateTeamAllies">>
<<set $allyTeam to []>>
<<if !$teamAlly1>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $teamAlly1 to _npc>>
<<set $allyTeam.push($teamAlly1)>>
<</if>>
<<if !$teamAlly2>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $teamAlly2 to _npc>>
<<set $allyTeam.push($teamAlly2)>>
<</if>>
<<if !$teamAlly3>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $teamAlly3 to _npc>>
<<set $allyTeam.push($teamAlly3)>>
<</if>>
<</widget>>
<<widget "generateTeamEnemies">>
<<set $enemyTeam to []>>
<<if !$enemyAlly1>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $enemyAlly1 to _npc>>
<<set $enemyTeam.push($enemyAlly1)>>
<</if>>
<<if !$enemyAlly2>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $enemyAlly2 to _npc>>
<<set $enemyTeam.push($enemyAlly2)>>
<</if>>
<<if !$enemyAlly3>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $enemyAlly3 to _npc>>
<<set $enemyTeam.push($enemyAlly3)>>
<</if>>
<<if !$enemyAlly4>>
<<applyDifficultyScaling $tournamentData.round>>
<<CreateNPC001>>
<<set $enemyAlly4 to _npc>>
<<set $enemyTeam.push($enemyAlly4)>>
<</if>>
<</widget>><<widget "TournamentMartialElimination">>
<<if !$pe or $pe eq 0>>
<div class="tournament-battle">
<h2>⚔️ <<print _format>> Battle</h2>
<img src="images/Story/arena.png" class="center" width="600">
</div>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">CURRENT BRACKET</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
<<if $tournamentData.round eq 1>>PRELIMINARY STAGE
<<elseif $tournamentData.round eq 2>>ROUND OF 16
<<elseif $tournamentData.round eq 3>>QUARTER-FINALS (TOP 8)
<<elseif $tournamentData.round eq 4>>SEMI-FINALS (TOP 4)
<<elseif $tournamentData.round eq 5>>CHAMPIONSHIP MATCH
<</if>>
</span>
</div>
<<generateSingleEliminationOpponent>>
<p>Your first opponent steps into the arena. This is the preliminary round.</p>
<<BeforeBattle>>
<<link "⚔️ Begin Duel" "TournamentBattle:Martial Elimination">>
<<set $nextPe to 1>><<set $pe to 0>><<set $actionsLeft to 3>>
<</link>>
<br><<elseif $pe eq 6>>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">YOU'VE WON THE CHAMPIONSHIP!</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
</span>
</div>
<<getMartialEliminationVictory>>
<<link "Celebrate Your Victory" $city>>
<<set $pe to 0>>
<<set $tournamentData to null>>
<<set $tournamentHost to null>>
<</link>>
<<elseif $pe eq "lost">>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">YOU'VE LOST AT <<if $tournamentData.round eq 0>>PRELIMINARY STAGE
<<elseif $tournamentData.round eq 2>>ROUND OF 16
<<elseif $tournamentData.round eq 3>>QUARTER-FINALS (TOP 8)
<<elseif $tournamentData.round eq 4>>SEMI-FINALS (TOP 4)
<<elseif $tournamentData.round eq 5>>CHAMPIONSHIP MATCH
<</if>>!</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
</span>
</div>
<<getMartialEliminationDefeat $tournamentData.round>>
<<link "I will come back... stronger..." $city>>
<<set $pe to 0>>
<<set $tournamentData to null>>
<<set $tournamentHost to null>>
<</link>>
<<else>>
<p>You recover between rounds, your body aching but your spirit high.</p>
<<if $actionsLeft gt 0>>
<<link "Rest" "TournamentBattle|FormatSpecific">><<set $health to Math.min($health + 0.3 * $maxhealth, $maxhealth)>><<set $actionsLeft -= 1>>
<</link>>
<</if>>
<<generateSingleEliminationOpponent>>
<<BeforeBattle>>
<br><<link "⚔️ Face Next Opponent" "TournamentBattle:Martial Elimination">>
<<set $pe to 0>>
<<set $actionsLeft to 3>>
<</link>>
<br><<linkappend "Observe other battles">>
<<set _watchfight to random(1,3)>>
<<if _watchfight eq 1>>
<p>Two unfamiliar cultivators clash in a blur of movement. One conjures spears of flame, the other counters with a spinning jade barrier. In moments, the match ends — a clean strike to the chest, a cloud of dust, and silence.</p>
<<elseif _watchfight eq 2>>
<p>You watch as a towering man swings a massive blade, each strike causing tremors. His opponent dances like a shadow, evading each blow — until one misstep seals their fate. The match is over in an instant.</p>
<<else>>
<p>Two elegant female cultivators duel mid-air. Petals and frost swirl around them as techniques collide. One miscalculates her descent, crashing into the stone — and the battle ends with a respectful bow.</p>
<</if>>
<</linkappend>>
<<if $actionsLeft gt 0 and $health lt $maxhealth>>
<br><<linkappend "Buy recovery potion">>
<p>You stagger slightly as you return to the waiting area. Your body aches, blood still trickling from wounds earned in the last fight.</p>
<p>A shady vendor with a crooked smile eyes you knowingly. His stall is cluttered with glowing vials.</p>
<span class="male">“You look like hell warmed over. Lucky for you, I sell miracles in bottles.”</span>
He uncorks a flask — sweet, sharp qi wafts toward you.
<span class="male">“Hmmm.... it will be 150 spirit stones. It'll patch you up before the next round. Interested?”</span>
<<if $gold gte 150>>
<<linkappend "Buy healing potion">>
<<set $health to $maxhealth>>
<<set $energy to $maxenergy>>
<<set $gold -= 150>>
<p>You slap the coins into his palm. He grins and hands over the vial.</p>
<p><span class="male">“Pleasure doing business.”</span></p>
<p>You down the potion in one go. Warmth floods your limbs, wounds knitting closed. Strength returns.</p>
<</linkappend>>
<<else>>
<p>Your coin pouch is nearly empty.</p>
<p>The shopkeeper hums, amused. <span class="male">“No gold? Then maybe you'd be willing to... negotiate.”</span></p>
<p>He steps closer, eyes roaming shamelessly. <span class="male">“My potions are potent — surely worth a few moans?”</span></p>
<<if $corruption gte 20>>
<<link "Give in to his offer" "Tournament|MerchantSex">>
<<set $sexCumcount to 0, $sexPosition to "", $sexFinished to false>>
<<set $tournamentpassage to passage()>>
<<set $scene to 0>>
<</link>>
<</if>>
<<linkappend "Refuse and fight injured">>
<p>You shake your head. You’ll face the next battle bloodied but unbroken.</p>
<p>The shopkeeper shrugs. <span class="male">“Suit yourself. Just don’t die out there. I hate cleaning up corpses.”</span></p>
<</linkappend>>
<</if>>
<</linkappend>>
<</if>> <</if>>
<</widget>>
<!- ═════════════════════════════════════════════════════════════
ARENA TEAM TOURNAMENT
═════════════════════════════════════════════════════════════ -->
<<widget "TournamentTeamElimination">>
<<if !$pe or $pe eq 0>>
<div class="tournament-battle">
<h2>⚔️ <<print _format>> Battle</h2>
<img src="images/Story/arena.png" class="center" width="600">
</div>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">CURRENT BRACKET</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
<<if $tournamentData.round eq 1>>PRELIMINARY STAGE
<<elseif $tournamentData.round eq 2>>ROUND OF 16
<<elseif $tournamentData.round eq 3>>QUARTER-FINALS (TOP 8)
<<elseif $tournamentData.round eq 4>>SEMI-FINALS (TOP 4)
<<elseif $tournamentData.round eq 5>>CHAMPIONSHIP MATCH
<</if>>
</span>
</div>
<<generateTeamAllies>>
<<generateTeamEnemies>>
<p>Your team steps into the arena. <strong>3 allies</strong> stand with you against <strong>4 opponents</strong>.</p>
<<TeamBeforeBattle>>
<<link "⚔️ Begin Team Fight" "TournamentBattle:Team Elimination">>
<<set $nextPe to 1>><<set $pe to 0>><<set $actionsLeft to 3>>
<</link>>
<<elseif $pe eq 6>>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">YOU'VE WON THE CHAMPIONSHIP!</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
</span>
</div>
<<getTeamTournamentVictory>>
<<link "Celebrate Your Victory" $city>>
<<set $pe to 0>>
<<set $tournamentData to null>>
<<set $tournamentHost to null>>
<</link>>
<<elseif $pe eq "lost">>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">YOUR TEAM HAS BEEN DEFEATED AT
<<if $tournamentData.round eq 0>>PRELIMINARY STAGE
<<elseif $tournamentData.round eq 2>>ROUND OF 16
<<elseif $tournamentData.round eq 3>>QUARTER-FINALS (TOP 8)
<<elseif $tournamentData.round eq 4>>SEMI-FINALS (TOP 4)
<<elseif $tournamentData.round eq 5>>CHAMPIONSHIP MATCH
<</if>>!</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
</span>
</div>
<<getTeamTournamentDefeat $tournamentData.round>>
<<set $pe to 0>>
<<set $tournamentData to null>>
<<set $tournamentHost to null>>
<<link "Leave the arena" $city>><</link>>
<<else>>
<div class="tournament-battle">
<h2>⚔️ <<print _format>> Battle</h2>
<img src="images/Story/arena.png" class="center" width="600">
</div>
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">CURRENT BRACKET</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
<<if $tournamentData.round eq 1>>PRELIMINARY STAGE
<<elseif $tournamentData.round eq 2>>ROUND OF 16
<<elseif $tournamentData.round eq 3>>QUARTER-FINALS (TOP 8)
<<elseif $tournamentData.round eq 4>>SEMI-FINALS (TOP 4)
<<elseif $tournamentData.round eq 5>>CHAMPIONSHIP MATCH
<</if>>
</span>
</div>
<p>Your team regroups and prepares for the next round.</p>
<<if $actionsLeft gt 0>>
<<link "Rest (Recover Health & Energy)" "TournamentBattle|FormatSpecific">>
<<set $health to Math.min($health + 0.3 * $maxhealth, $maxhealth)>>
<<set $energy to Math.min($energy + 0.3 * $maxenergy, $maxenergy)>>
<<for _ally range $allyTeam>>
<!-- Heal Health by 30% without exceeding Max Health -->
<<set _ally.NPCcurrenthealth to Math.min(_ally.NPCcurrenthealth + (0.3 * _ally.NPCmaxhealth), _ally.NPCmaxhealth)>>
<!-- Restore Energy by 30% without exceeding Max Energy -->
<<set _ally.NPCenergy to Math.min(_ally.NPCenergy + (0.3 * _ally.NPCmaxenergy), _ally.NPCmaxenergy)>>
<</for>>
<<set $actionsLeft -= 1>>
<p>You and your teammates tend wounds and recover some strength.</p>
<</link>>
<</if>>
<br><<link "⚔️ Face Next Opposing Team" "TournamentBattle:Team Elimination">>
<<generateTeamEnemies>>
<<TeamBeforeBattle>>
<<set $pe to 0>>
<<set $actionsLeft to 3>>
<</link>>
/* Observe other battles, potion vendor, etc. (same as before) */
<br><<linkappend "Observe other battles">>
<<set _watchfight to random(1,3)>>
<<if _watchfight eq 1>>
<p>Two teams clash in a frantic exchange. One side’s formation crumbles after a coordinated strike.</p>
<<elseif _watchfight eq 2>>
<p>A lone cultivator on a losing team makes a heroic last stand, but is eventually overwhelmed.</p>
<<else>>
<p>You witness a perfectly executed pincer movement – a team of four moving as one. Impressive.</p>
<</if>>
<</linkappend>>
<<if $actionsLeft gt 0 and $health lt $maxhealth>>
<br><<linkappend "Buy recovery potion">>
<p>You stagger slightly as you return to the waiting area. Your body aches, blood still trickling from wounds earned in the last fight.</p>
<p>A shady vendor with a crooked smile eyes you knowingly. His stall is cluttered with glowing vials.</p>
<span class="male">“You look like hell warmed over. Lucky for you, I sell miracles in bottles.”</span>
He uncorks a flask — sweet, sharp qi wafts toward you.
<span class="male">“Hmmm.... it will be 150 spirit stones. It'll patch you up before the next round. Interested?”</span>
<<if $gold gte 150>>
<<linkappend "Buy healing potion">>
<<set $health to $maxhealth>>
<<set $energy to $maxenergy>>
<<set $gold -= 150>>
<p>You slap the coins into his palm. He grins and hands over the vial.</p>
<p><span class="male">“Pleasure doing business.”</span></p>
<p>You down the potion in one go. Warmth floods your limbs, wounds knitting closed. Strength returns.</p>
<</linkappend>>
<<else>>
<p>Your coin pouch is nearly empty.</p>
<p>The shopkeeper hums, amused. <span class="male">“No gold? Then maybe you'd be willing to... negotiate.”</span></p>
<p>He steps closer, eyes roaming shamelessly. <span class="male">“My potions are potent — surely worth a few moans?”</span></p>
<<if $corruption gte 20>>
<<link "Give in to his offer" "Tournament|MerchantSex">>
<<set $sexCumcount to 0, $sexPosition to "", $sexFinished to false>>
<<set $tournamentpassage to passage()>>
<<set $scene to 0>>
<</link>>
<</if>>
<<linkappend "Refuse and fight injured">>
<p>You shake your head. You’ll face the next battle bloodied but unbroken.</p>
<p>The shopkeeper shrugs. <span class="male">“Suit yourself. Just don’t die out there. I hate cleaning up corpses.”</span></p>
<</linkappend>>
<</if>>
<</linkappend>>
<</if>>
<</if>>
<</widget>><<widget "BackgroundHandler">>
<<if $backgroundClass eq "tavern">>
<img src="images/Background/tavern.jpg" style="width: 100%; display: block;">
<<elseif $backgroundClass eq "tavernRoom">>
<<set $random=random(1,2)>>
<<if $random eq 1>>
<img src="images/Background/tavernRoom.jpg" style="width: 100%; display: block;">
<<elseif $random eq 2>>
<img src="images/Background/tavernRoom1.jpg" style="width: 100%; display: block;">
<</if>>
<<else>>
<<set $random=random(1,10)>>
<<if $random eq 1>>
<img src="images/Background/bamboo_forest.jpg" style="width: 100%; display: block;">
<<elseif $random eq 2>>
<img src="images/Background/bamboo_forest1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 3>>
<img src="images/Background/mountain_top.jpg" style="width: 100%; display: block;">
<<elseif $random eq 4>>
<img src="images/Background/mountain_top1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 5>>
<img src="images/Background/plumgrove.jpg" style="width: 100%; display: block;">
<<elseif $random eq 6>>
<img src="images/Background/plumgrove1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 7>>
<img src="images/Background/waterfall.jpg" style="width: 100%; display: block;">
<<elseif $random eq 8>>
<img src="images/Background/waterfall1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 9>>
<img src="images/Background/forest.jpg" style="width: 100%; display: block;">
<<elseif $random eq 10>>
<img src="images/Background/forest1.jpg" style="width: 100%; display: block;">
<</if>><</if>>
<</widget>><<widget "BeforeBattle">>
<<set _enemy = $args[0] ?? _npc>>
<<set $currentEnemy to clone(_enemy)>>
<<set $currentEnemy.NPCcurrenthealth to $currentEnemy.NPCmaxhealth>>
<<set $currentEnemy.NPCcurrentenergy to $currentEnemy.NPCmaxenergy>>
<<set $battleWon = false>>
<<set $defeatedEnemy = null>>
<<set $playerLost = false>>
<<set $returnpassage to passage()>>
<</widget>>
<<widget "PlayerAttackAttempt">>
<<set _hitChance = 50 + ($agility - $currentEnemy.NPCagility)>>
/* clamp */
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $playeraction = "attack success">>
<<else>>
<<set $playeraction = "attack failure">>
<br>─── ⚔️ ───<br>
<</if>>
<</widget>>
<<widget "PlayerAttackDamage">>
<<set $playermindamage = Math.round($atk * 0.8)>>
<<set $playermaxdamage = Math.round($atk * 1.2 + ($basestrength / 3) + ($martialArts / 4))>>
<<set $playerdamageroll = random($playermindamage, $playermaxdamage)>>
<<set $playerdamagerolltotal = $playerdamageroll + ($basestrength / 2)>>
<<set $damagetoenemy = Math.round($playerdamagerolltotal - $currentEnemy.NPCdef)>>
<<if $damagetoenemy lt 0>>
<<set $damagetoenemy = 0>>
<</if>>
<<set $currentEnemy.NPCcurrenthealth -= $damagetoenemy>>
<<if $currentEnemy.NPCcurrenthealth lt 0>>
<<set $currentEnemy.NPCcurrenthealth = 0>>
<</if>>
<<set $temp_player_damage = $damagetoenemy>>
<<if $temp_player_damage lte 0>>
<<set $temp_player_damage = random(1,3)>>
Your strike bounces off the enemy's skin — it's as if you're punching a steel wall powered by spiritual essence.
You deal <<print $damagetoenemy.toFixed(2)>> damage!
<<else>>
You channel your Qi into your strike... It pierces the enemy's defense!
You strike your enemy, dealing <<print $damagetoenemy.toFixed(2)>> damage!
<</if>>
<</widget>>
<<widget "EnemyAttackAttempt">>
<<set _hitChance = 50 + ($currentEnemy.NPCagility - $agility)>>
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $enemyaction = "attack success">>
<<else>>
<<set $enemyaction = "attack failure">>
<br>─── ⚔️ ───<br>
<</if>>
<</widget>>
<<widget "EnemyAttackDamage">>
<<set $enemymindamage = Math.round($currentEnemy.NPCatk * 0.8)>>
<<set $enemymaxdamage = Math.round($currentEnemy.NPCatk * 1.2 + ($currentEnemy.NPCbasestrength / 3) + ($currentEnemy.NPCmartialArts / 4))>>
<<set $enemydamageroll = random($enemymindamage, $enemymaxdamage)>>
<<set $enemydamagerolltotal = $enemydamageroll + ($currentEnemy.NPCbasestrength / 2)>>
<<set $damagetoplayer = Math.round($enemydamagerolltotal - $def)>>
<<if $damagetoplayer lt 0>>
<<set $damagetoplayer = 0>>
<</if>>
<<set $health -= $damagetoplayer>>
<<if $health lt 0>>
<<set $health = 0>>
<</if>>
<<set $temp_enemy_damage = $damagetoplayer>>
<<if $temp_enemy_damage lte 0>>
<<set $temp_enemy_damage = random(1, 3)>>
Your defensive technique holds — you feel nothing.
<<else>>
The enemy strikes you fiercely, dealing <<print $damagetoplayer.toFixed(2)>> damage!
<<set _random to random(0,100)>>
<<if _random lte 10>>
Enemy attack torn a small part of your robes!
<<set $equippedRobe.durability -= random(5, 10)>>
<</if>>
<</if>>
<</widget>>
<<widget "EnemyBattleTable">>
<div class="xianxia-enemy-table">
<div class="xianxia-name"><<print $currentEnemy.fullname>></div>
<div class="xianxia-enemy-table-splitter"></div>
<<if $currentEnemy.realm>>
<div class="xianxia-realm">$currentEnemy.realm</div>
<</if>>
<div class="xianxia-enemy-table-splitter"></div>
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center;">
<div class="xianxia-label" style="margin: 0px 1em 0px 0px;">Health:</div>
<div class="xianxia-value"><<print $currentEnemy.NPCcurrenthealth.toFixed(0)>> / <<print $currentEnemy.NPCmaxhealth>></div>
</div>
<div class="xianxia-enemy-table-splitter"></div>
<<if $currentEnemy.NPCcurrenthealth == $currentEnemy.NPCmaxhealth>>
<img src="images/Story/health10.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.9)>>
<img src="images/Story/health9.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.8)>>
<img src="images/Story/health8.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.7)>>
<img src="images/Story/health7.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.6)>>
<img src="images/Story/health6.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.5)>>
<img src="images/Story/health5.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.4)>>
<img src="images/Story/health4.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.3)>>
<img src="images/Story/health3.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.2)>>
<img src="images/Story/health2.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.1)>>
<img src="images/Story/health1.png" width="200" />
<<else>>
<img src="images/Story/health0.png" width="200" />
<</if>>
</div>
<</widget>>
<<widget "EnemyStun">>\
<<set $enemyaction = $currentEnemy.enemyAbility.random()>>
<<set $currentEnemy.enemyAbility.push($enemyaction)>>
<</widget>>
<<widget "AfterBattle">>
<<set $passiveatk to 0>>
<<set $passivedef to 0>>
<<set $passivecrit to 0>>
<<set $passivecritres to 0>>
<<set $passiveagility to 0>>
<<set $$battleRound to 0>>
<</widget>>
<!-- ================ALLY ACTIONS=========================--><<widget "TeamBeforeBattle">>
<!-- Enemy no. 1 -->
<<set $currentEnemy1 to clone($enemyAlly1)>>
<<set $currentEnemy1.NPCcurrenthealth to $currentEnemy1.NPCmaxhealth>>
<<set $currentEnemy1.NPCcurrentenergy to $currentEnemy1.NPCmaxenergy>>
<!-- Enemy no. 2 -->
<<set $currentEnemy2 to clone($enemyAlly2)>>
<<set $currentEnemy2.NPCcurrenthealth to $currentEnemy2.NPCmaxhealth>>
<<set $currentEnemy2.NPCcurrentenergy to $currentEnemy2.NPCmaxenergy>>
<!-- Enemy no. 3 -->
<<set $currentEnemy3 to clone($enemyAlly3)>>
<<set $currentEnemy3.NPCcurrenthealth to $currentEnemy3.NPCmaxhealth>>
<<set $currentEnemy3.NPCcurrentenergy to $currentEnemy3.NPCmaxenergy>>
<!-- Enemy no. 4 -->
<<set $currentEnemy4 to clone($enemyAlly4)>>
<<set $currentEnemy4.NPCcurrenthealth to $currentEnemy4.NPCmaxhealth>>
<<set $currentEnemy4.NPCcurrentenergy to $currentEnemy4.NPCmaxenergy>>
<<set $battleWon = false>>
<<set $defeatedEnemy = null>>
<<set $playerLost = false>>
<<set $returnpassage to passage()>>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════════════
ALLY ATTACKS - Simple
═══════════════════════════════════════════════════════════════════════ -->
<<widget "AllyAttackAttempt">>
<<set _hitChance = 50 + ($args[0].NPCagility - $args[1].NPCagility)>>
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $allyaction = "attack success">>
<<else>>
<<set $allyaction = "attack failure">>
<</if>>
<</widget>>
<<widget "AllyAttackDamage">>
<<set _ally = $args[0]>>
<<set _target = $args[1]>>
<<set _mindamage = Math.round(_ally.NPCatk * 0.8)>>
<<set _maxdamage = Math.round(_ally.NPCatk * 1.2 + (_ally.NPCbasestrength / 3) + (_ally.NPCmartialArts / 4))>>
<<set _damageroll = random(_mindamage, _maxdamage)>>
<<set _damagerolltotal = _damageroll + (_ally.NPCbasestrength / 2)>>
<<set _damagetoenemy = Math.round(_damagerolltotal - _target.NPCdef)>>
<<if _damagetoenemy lt 0>>
<<set _damagetoenemy = 0>>
<</if>>
<<set _target.NPCcurrenthealth -= _damagetoenemy>>
<<if _target.NPCcurrenthealth lt 0>>
<<set _target.NPCcurrenthealth = 0>>
<</if>>
<<if _damagetoenemy lte 0>>
<<print _ally.fullname>>'s strike bounces off! (0 damage)
<<else>>
<<print _ally.fullname>> strikes <<print _target.fullname>> for <<print _damagetoenemy.toFixed(2)>> damage!
<</if>>
<</widget>>
<!-- ═══════════════════════════════════════════════════════════════════════
ENEMY ATTACKS - With targeting (player or ally)
═══════════════════════════════════════════════════════════════════════ -->
<<widget "EnemyTeamAttackAttempt">>
<<set _enemy = $args[0]>>
<<set _target = $args[1]>>
<<set _hitChance = 50 + (_enemy.NPCagility - _target.NPCagility)>>
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $enemyaction = "attack success">>
<<else>>
<<set $enemyaction = "attack failure">>
<</if>>
<</widget>>
<<widget "EnemyTeamAttackDamage">>
<<set _enemy = $args[0]>>
<<set _target = $args[1]>>
<<set _isPlayer = $args[2] ?? false>>
<<set _mindamage = Math.round(_enemy.NPCatk * 0.8)>>
<<set _maxdamage = Math.round(_enemy.NPCatk * 1.2 + (_enemy.NPCbasestrength / 3) + (_enemy.NPCmartialArts / 4))>>
<<set _damageroll = random(_mindamage, _maxdamage)>>
<<set _damagerolltotal = _damageroll + (_enemy.NPCbasestrength / 2)>>
<<set _damagetotarget = Math.round(_damagerolltotal - _target.NPCdef)>>
<<if _damagetotarget lt 0>>
<<set _damagetotarget = 0>>
<</if>>
<<if _isPlayer>>
<<set $health -= _damagetotarget>>
<<if $health lt 0>>
<<set $health = 0>>
<</if>>
<<else>>
<<set _target.NPCcurrenthealth -= _damagetotarget>>
<<if _target.NPCcurrenthealth lt 0>>
<<set _target.NPCcurrenthealth = 0>>
<</if>>
<</if>>
<<if _damagetotarget lte 0>>
<<print _enemy.fullname>>'s attack is blocked! (0 damage)
<<else>>
<<print _enemy.fullname>> strikes <<print _target.fullname>> for <<print _damagetotarget.toFixed(2)>> damage!
<</if>>
<</widget>>
<<widget "EnemyGroupBattleTable">>
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; justify-items: center;">
<<for _enemy range $enemyTeam>>
<div class="xianxia-enemy-table" style="display: flex; flex-direction: column; align-items: center; padding-bottom: 10px;">
<<if _enemy.NPCcurrenthealth >= 0>>
<div class="xianxia-name"><<print _enemy.fullname>></div>
<div class="xianxia-enemy-table-splitter"></div>
<<if _enemy.realm>>
<div class="xianxia-realm"><<print _enemy.realm>></div>
<</if>>
<div class="xianxia-enemy-table-splitter"></div>
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; width: 100%;">
<div class="xianxia-label" style="margin: 0px 1em 0px 0px;">Health:</div>
<<if _enemy.NPCcurrenthealth gt 0>>
<div class="xianxia-value"><<print _enemy.NPCcurrenthealth.toFixed(0)>> / <<print _enemy.NPCmaxhealth>></div>
<<else>>
<p style="color:#888; text-align: center;">(Defeated)</p>
<</if>>
</div>
<</if>>
</div>
<</for>>
</div>
<</widget>>
<<widget "AllyGroupBattleTable">>
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; justify-items: center;">
<<for _ally range $allyTeam>>
<div class="xianxia-ally-table" style="display: flex; flex-direction: column; align-items: center; padding-bottom: 10px;">
<<if _ally.NPCcurrenthealth >= 0>>
<div class="xianxia-name"><<print _ally.fullname>></div>
<div class="xianxia-ally-table-splitter"></div>
<<if _ally.realm>>
<div class="xianxia-realm"><<print _ally.realm>></div>
<</if>>
<div class="xianxia-ally-table-splitter"></div>
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; width: 100%;">
<div class="xianxia-label" style="margin: 0px 1em 0px 0px;">Health:</div>
<<if _ally.NPCcurrenthealth gt 0>>
<div class="xianxia-value"><<print _ally.NPCcurrenthealth.toFixed(0)>> / <<print _ally.NPCmaxhealth>></div>
<<else>>
<p style="color:#888; text-align: center;">(Defeated)</p>
<</if>>
</div>
<</if>>
</div>
<</for>>
</div>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
TEAM BATTLE - PLAYER ATTACK (uses $enemyTeam array)
═════════════════════════════════════════════════════════════ -->
<<widget "PlayerTeamAttackAttempt">>
<<set _target = $enemyTeam[$playerTargetIdx]>>
<<set _hitChance = 50 + ($agility - _target.NPCagility)>>
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $playeraction = "attack success">>
<<else>>
<<set $playeraction = "attack failure">>
<</if>>
<</widget>>
<<widget "PlayerTeamAttackDamage">>
<<set _target = $enemyTeam[$playerTargetIdx]>>
<<set $playermindamage = Math.round($atk * 0.8)>>
<<set $playermaxdamage = Math.round($atk * 1.2 + ($basestrength / 3) + ($martialArts / 4))>>
<<set $playerdamageroll = random($playermindamage, $playermaxdamage)>>
<<set $playerdamagerolltotal = $playerdamageroll + ($basestrength / 2)>>
<<set $damagetoenemy = Math.round($playerdamagerolltotal - _target.NPCdef)>>
<<if $damagetoenemy lt 0>>
<<set $damagetoenemy = 0>>
<</if>>
<<set _target.NPCcurrenthealth -= $damagetoenemy>>
<<if _target.NPCcurrenthealth lt 0>>
<<set _target.NPCcurrenthealth = 0>>
<</if>>
<<if $damagetoenemy lte 0>>
Your strike bounces off the enemy's skin — it's as if you're punching a steel wall powered by spiritual essence.
You deal <<print $damagetoenemy.toFixed(2)>> damage!
<<else>>
You channel your Qi into your strike... It pierces the enemy's defense!
You strike your enemy, dealing <<print $damagetoenemy.toFixed(2)>> damage!
<</if>>
<</widget>><<widget "HumanPickFight">>
<<set _roll = ["RogueSwordsman","DemonicDisciple","RighteousDisciple","WanderingElder","BanditCultivator","DemonicAssassin"].random()>>
<<if _roll eq "RogueSwordsman">><<RogueSwordsman>>
<<elseif _roll eq "DemonicDisciple">><<DemonicDisciple>>
<<elseif _roll eq "RighteousDisciple">><<RighteousDisciple>>
<<elseif _roll eq "WanderingElder">><<WanderingElder>>
<<elseif _roll eq "BanditCultivator">><<BanditCultivator>>
<<elseif _roll eq "DemonicAssassin">><<DemonicAssassin>>
<</if>>
<</widget>>
/* ══════════════════════════════════════════════════════
HUMAN CULTIVATOR ENEMY WIDGETS
──────────────────────────────
All widgets follow the same structure as beast widgets.
Stats pulled from $GenerationNPCRealmStats.
_loot returns $gold amount scaled to realm.
Lewd ability strings: "grope_chest", "grope_thigh",
"grope_ass", "finger" — handle logic in battle system.
══════════════════════════════════════════════════════ */
/* ── Shared realm setup macro ──────────────────────────
Called at the top of every widget.
Sets: _realm, _stageType, _cultivation, _stats, _gold
───────────────────────────────────────────────────── */
<<widget "HumanEnemyRealmSetup">>
<<set _realm = ["Body Tempering Realm","Meridian Awakening Realm","Qi Condensation Realm","Foundation Establishment Realm","Core Formation Realm","Nascent Soul Realm"].random()>>
<<set _stageType = ["Early","Middle","Late"].random()>>
<<set _cultivation = _realm + " " + _stageType>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<<if _realm eq "Body Tempering Realm">>
<<set _gold = random(150, 200)>>
<<elseif _realm eq "Meridian Awakening Realm">>
<<set _gold = random(200, 350)>>
<<elseif _realm eq "Qi Condensation Realm">>
<<set _gold = random(350, 600)>>
<<elseif _realm eq "Foundation Establishment Realm">>
<<set _gold = random(600, 1000)>>
<<elseif _realm eq "Core Formation Realm">>
<<set _gold = random(1000, 2000)>>
<<else>>
<<set _gold = random(2000, 4000)>>
<</if>>
<</widget>>
/* ══════════════════════════════════════════════════════
1. ROGUE SWORDSMAN
Unaffiliated. Aggressive. High atk, low def.
══════════════════════════════════════════════════════ */
<<widget "RogueSwordsman">>\
<<silently>>\
<<HumanEnemyRealmSetup>>
<<set _gender = ["male","female"].random()>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Rogue Swordsman1">>
<<set _sectAffiliation = "Unaffiliated">>
<<set _enemySect = ["righteous","demonic"].random()>>
<<set _sectRank = "">>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _enemyEXP = random(20, 50)>>
<<set _enemyability = ["attack","attack","attack","grope_chest","grope_thigh"]>>
<<set _loot = {gold: _gold}>>
<<set _description = "A swordsman with no sect and no allegiances — which means no rules either. Their blade is notched from hard use and their eyes carry the flat calm of someone who has made peace with violence.">>
<<set _npc = {
fullname: _fullname,
name: _name,
surname: _surname,
gender: _gender,
npcPortrait: _npcPortrait,
sectNPC: _sectAffiliation,
enemySectType: _enemySect,
NPCrank: _sectRank,
realm: _cultivation,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>\
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
2. DEMONIC DISCIPLE
Ghost King Netherworld Sect. Aggressive and lewd.
══════════════════════════════════════════════════════ */
<<widget "DemonicDisciple">>\
<<silently>>\
<<HumanEnemyRealmSetup>>
<<set _gender = ["male","female"].random()>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Demonic Disciple">>
<<set _sectAffiliation = "Ghost King Netherworld Sect">>
<<set _enemySect = "demonic">>
<<set _sectRank = ["Member","Disciple","Elder"].random()>>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _enemyEXP = random(25, 55)>>
<<set _enemyability = ["attack","attack","grope_chest","grope_ass","finger","grope_thigh","attack"]>>
<<set _loot = {gold: _gold}>>
<<set _description = "A disciple of the Ghost King Netherworld Sect, their robes dark as a starless sky. Dark qi coils around their hands. Their eyes move over you like they're already deciding what to do with you after you fall.">>
<<set _npc = {
fullname: _fullname,
name: _name,
surname: _surname,
gender: _gender,
npcPortrait: _npcPortrait,
sectNPC: _sectAffiliation,
enemySectType: _enemySect,
NPCrank: _sectRank,
realm: _cultivation,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>\
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
3. RIGHTEOUS DISCIPLE
Clear Sky Azure Dragon Pavilion. Defensive, proud.
══════════════════════════════════════════════════════ */
<<widget "RighteousDisciple">>\
<<silently>>\
<<HumanEnemyRealmSetup>>
<<set _gender = ["male","female"].random()>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Righteous Disciple">>
<<set _sectAffiliation = "Clear Sky Azure Dragon Pavilion">>
<<set _enemySect = "righteous">>
<<set _sectRank = ["Member","Disciple","Elder"].random()>>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _enemyEXP = random(25, 55)>>
<<set _enemyability = ["attack","defend","attack","defend","grope_thigh","attack"]>>
<<set _loot = {gold: _gold}>>
<<set _description = "A disciple of the Clear Sky Azure Dragon Pavilion, their azure robes immaculate despite the surroundings. They carry themselves with the quiet confidence of someone who trains twice as hard as they need to. Their expression makes clear they consider this beneath them.">>
<<set _npc = {
fullname: _fullname,
name: _name,
surname: _surname,
gender: _gender,
npcPortrait: _npcPortrait,
sectNPC: _sectAffiliation,
enemySectType: _enemySect,
NPCrank: _sectRank,
realm: _cultivation,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>\
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
4. WANDERING ELDER
Unaffiliated. High realm. Unpredictable.
══════════════════════════════════════════════════════ */
<<widget "WanderingElder">>\
<<silently>>\
<<HumanEnemyRealmSetup>>
<<set _gender = ["male","female"].random()>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Wandering Elder">>
<<set _sectAffiliation = "Unaffiliated">>
<<set _enemySect = ["righteous","demonic"].random()>>
<<set _sectRank = "">>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _enemyEXP = random(40, 80)>>
<<set _enemyability = ["attack","attack","defend","attack","grope_chest","grope_ass"]>>
<<set _loot = {gold: _gold}>>
<<set _description = "An elder with no sect name and no introduction. Their robes are travel-worn but their qi pressure is unmistakable — the kind that accumulates over centuries of surviving things that killed everyone else in the room. They are not here by accident.">>
<<set _npc = {
fullname: _fullname,
name: _name,
surname: _surname,
gender: _gender,
npcPortrait: _npcPortrait,
sectNPC: _sectAffiliation,
enemySectType: _enemySect,
NPCrank: _sectRank,
realm: _cultivation,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>\
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
5. BANDIT CULTIVATOR
Unaffiliated. Low aggression, opportunistic.
Heavy lewd pool — takes advantage when winning.
══════════════════════════════════════════════════════ */
<<widget "BanditCultivator">>\
<<silently>>\
<<HumanEnemyRealmSetup>>
<<set _gender = ["male","female"].random()>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Bandit Cultivator">>
<<set _sectAffiliation = "Unaffiliated">>
<<set _enemySect = "demonic">>
<<set _sectRank = "">>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _enemyEXP = random(15, 35)>>
<<set _enemyability = ["attack","grope_chest","grope_thigh","grope_ass","finger","attack","grope_chest"]>>
<<set _loot = {gold: _gold}>>
<<set _description = "A cultivator who gave up on a legitimate path — or was never offered one. Their technique is rough and self-taught, full of holes, but they've learned to fight dirty to compensate. They size you up with unconcealed interest.">>
<<set _npc = {
fullname: _fullname,
name: _name,
surname: _surname,
gender: _gender,
npcPortrait: _npcPortrait,
sectNPC: _sectAffiliation,
enemySectType: _enemySect,
NPCrank: _sectRank,
realm: _cultivation,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>\
<</silently>>\
<</widget>>\
/* ══════════════════════════════════════════════════════
6. DEMONIC ASSASSIN
Ghost King Netherworld Sect. High agility/crit.
Strikes fast, uses openings lewdly.
══════════════════════════════════════════════════════ */
<<widget "DemonicAssassin">>\
<<silently>>\
<<HumanEnemyRealmSetup>>
<<set _gender = ["male","female"].random()>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _npcPortrait = "male" + random(1, 32)>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _npcPortrait = "female" + random(1, 26)>>
<</if>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Demonic Assassin">>
<<set _sectAffiliation = "Ghost King Netherworld Sect">>
<<set _enemySect = "demonic">>
<<set _sectRank = ["Member","Disciple"].random()>>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _enemyEXP = random(30, 65)>>
<<set _enemyability = ["attack","attack","evade","attack","finger","grope_chest","grope_ass","attack"]>>
<<set _loot = {gold: _gold}>>
<<set _description = "A shadow that moves wrong — too fast, too quiet, arriving where you weren't watching. Their Ghost King sect mark is hidden under a plain collar but the dark qi signature is unmistakable up close. They fight with the economy of someone paid per second.">>
<<set _npc = {
fullname: _fullname,
name: _name,
surname: _surname,
gender: _gender,
npcPortrait: _npcPortrait,
sectNPC: _sectAffiliation,
enemySectType: _enemySect,
NPCrank: _sectRank,
realm: _cultivation,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP,
enemyLoot: _loot
}>>\
<</silently>>\
<</widget>>\/* Game Update Widget for 0.16*/
<<widget "GameUpdateWidget-016">>
<<set $cultivationRealms = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set $cultivationStages = ["Early", "Middle", "Late"]>>
<<set $GenerationNPCRealmStats = {
"Body Tempering Realm": {
"Early": {
"lifespan": [70, 80],
"health": [250, 320],
"energy": [180, 220],
"luck": [4, 6],
"insight": [4, 6],
"basestrength": [4, 6],
"basewillpower": [4, 6],
"atk": [35, 45],
"def": [4, 6],
"crit": [2, 4],
"critres": [1, 2],
"agility": [6, 8],
"martialArts": [8, 12],
"spiritualRoot": [9, 11]
},
"Middle": {
"lifespan": [85, 115],
"health": [350, 450],
"energy": [250, 320],
"luck": [6, 10],
"insight": [6, 10],
"basestrength": [7, 10],
"basewillpower": [6, 9],
"atk": [45, 85],
"def": [6, 10],
"crit": [4, 7],
"critres": [3, 5],
"agility": [8, 12],
"martialArts": [12, 18],
"spiritualRoot": [11, 14]
},
"Late": {
"lifespan": [115, 130],
"health": [500, 700],
"energy": [350, 500],
"luck": [8, 14],
"insight": [10, 16],
"basestrength": [11, 15],
"basewillpower": [10, 14],
"atk": [85, 120],
"def": [12, 18],
"crit": [6, 10],
"critres": [6, 10],
"agility": [12, 18],
"martialArts": [16, 25],
"spiritualRoot": [15, 20]
}
},
"Meridian Awakening Realm": {
"Early": {
"lifespan": [135, 140],
"health": [750, 900],
"energy": [600, 720],
"luck": [10, 14],
"insight": [12, 16],
"basestrength": [16, 20],
"basewillpower": [14, 18],
"atk": [120, 170],
"def": [20, 30],
"crit": [8, 12],
"critres": [8, 12],
"agility": [16, 22],
"martialArts": [24, 32],
"spiritualRoot": [22, 30]
},
"Middle": {
"lifespan": [145, 150],
"health": [1000, 1200],
"energy": [800, 1000],
"luck": [14, 20],
"insight": [18, 24],
"basestrength": [20, 26],
"basewillpower": [18, 24],
"atk": [170, 220],
"def": [28, 40],
"crit": [10, 16],
"critres": [10, 16],
"agility": [22, 30],
"martialArts": [30, 40],
"spiritualRoot": [28, 36]
},
"Late": {
"lifespan": [155, 160],
"health": [1400, 1800],
"energy": [1200, 1600],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [28, 36],
"basewillpower": [26, 32],
"atk": [220, 270],
"def": [40, 55],
"crit": [14, 20],
"critres": [14, 20],
"agility": [30, 40],
"martialArts": [38, 50],
"spiritualRoot": [35, 45]
}
},
"Qi Condensation Realm": {
"Early": {
"lifespan": [165, 170],
"health": [1900, 2300],
"energy": [1700, 2100],
"luck": [15, 20],
"insight": [20, 26],
"basestrength": [30, 38],
"basewillpower": [28, 35],
"atk": [300, 380],
"def": [45, 65],
"crit": [12, 18],
"critres": [12, 18],
"agility": [35, 45],
"martialArts": [45, 60],
"spiritualRoot": [40, 55]
},
"Middle": {
"lifespan": [175, 185],
"health": [2400, 2900],
"energy": [2200, 2700],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [38, 48],
"basewillpower": [35, 44],
"atk": [380, 480],
"def": [60, 85],
"crit": [16, 24],
"critres": [16, 24],
"agility": [45, 58],
"martialArts": [58, 75],
"spiritualRoot": [52, 70]
},
"Late": {
"lifespan": [190, 210],
"health": [3000, 3800],
"energy": [2800, 3500],
"luck": [26, 36],
"insight": [34, 44],
"basestrength": [48, 60],
"basewillpower": [44, 55],
"atk": [480, 580],
"def": [80, 110],
"crit": [22, 30],
"critres": [22, 30],
"agility": [55, 70],
"martialArts": [72, 90],
"spiritualRoot": [65, 85]
}
},
"Foundation Establishment Realm": {
"Early": {
"lifespan": [220, 250],
"health": [4200, 5200],
"energy": [3800, 4600],
"luck": [28, 38],
"insight": [38, 50],
"basestrength": [55, 70],
"basewillpower": [50, 65],
"atk": [620, 750],
"def": [100, 135],
"crit": [25, 35],
"critres": [25, 35],
"agility": [65, 82],
"martialArts": [85, 110],
"spiritualRoot": [80, 105]
},
"Middle": {
"lifespan": [255, 290],
"health": [5400, 6800],
"energy": [4800, 5900],
"luck": [35, 48],
"insight": [48, 62],
"basestrength": [68, 85],
"basewillpower": [62, 78],
"atk": [760, 920],
"def": [130, 170],
"crit": [32, 45],
"critres": [32, 45],
"agility": [80, 100],
"martialArts": [105, 135],
"spiritualRoot": [100, 130]
},
"Late": {
"lifespan": [300, 350],
"health": [7000, 8800],
"energy": [6100, 7600],
"luck": [45, 60],
"insight": [60, 78],
"basestrength": [85, 105],
"basewillpower": [78, 95],
"atk": [930, 1120],
"def": [165, 215],
"crit": [40, 55],
"critres": [40, 55],
"agility": [98, 122],
"martialArts": [130, 165],
"spiritualRoot": [125, 160]
}
},
"Core Formation Realm": {
"Early": {
"lifespan": [380, 450],
"health": [9500, 12000],
"energy": [8500, 10500],
"luck": [50, 68],
"insight": [70, 90],
"basestrength": [110, 140],
"basewillpower": [100, 125],
"atk": [1250, 1550],
"def": [220, 290],
"crit": [48, 65],
"critres": [48, 65],
"agility": [120, 150],
"martialArts": [170, 215],
"spiritualRoot": [155, 200]
},
"Middle": {
"lifespan": [460, 550],
"health": [12500, 15800],
"energy": [11000, 13800],
"luck": [65, 85],
"insight": [88, 112],
"basestrength": [135, 170],
"basewillpower": [125, 155],
"atk": [1580, 1950],
"def": [280, 370],
"crit": [60, 80],
"critres": [60, 80],
"agility": [150, 185],
"martialArts": [210, 265],
"spiritualRoot": [195, 245]
},
"Late": {
"lifespan": [560, 700],
"health": [16500, 21000],
"energy": [14500, 18000],
"luck": [80, 105],
"insight": [110, 140],
"basestrength": [165, 210],
"basewillpower": [155, 190],
"atk": [1980, 2450],
"def": [360, 470],
"crit": [75, 100],
"critres": [75, 100],
"agility": [185, 230],
"martialArts": [260, 330],
"spiritualRoot": [240, 300]
}
},
"Nascent Soul Realm": {
"Early": {
"lifespan": [800, 1200],
"health": [24000, 31000],
"energy": [21000, 27000],
"luck": [95, 125],
"insight": [130, 170],
"basestrength": [220, 280],
"basewillpower": [200, 255],
"atk": [2700, 3400],
"def": [480, 620],
"crit": [90, 120],
"critres": [90, 120],
"agility": [240, 300],
"martialArts": [340, 430],
"spiritualRoot": [290, 370]
},
"Middle": {
"lifespan": [1300, 1800],
"health": [32000, 42000],
"energy": [28000, 36000],
"luck": [120, 160],
"insight": [165, 215],
"basestrength": [275, 350],
"basewillpower": [255, 320],
"atk": [3500, 4400],
"def": [610, 790],
"crit": [115, 150],
"critres": [115, 150],
"agility": [300, 375],
"martialArts": [430, 540],
"spiritualRoot": [360, 460]
},
"Late": {
"lifespan": [2000, 3000],
"health": [45000, 60000],
"energy": [39000, 52000],
"luck": [155, 210],
"insight": [210, 270],
"basestrength": [350, 440],
"basewillpower": [320, 400],
"atk": [4600, 5800],
"def": [780, 1000],
"crit": [145, 190],
"critres": [145, 190],
"agility": [380, 480],
"martialArts": [550, 700],
"spiritualRoot": [450, 580]
}
}
}>>
<<set $gameVersion = 0.16>>
<</widget>>
<<widget "GameUpdateWidget-017a">>
<<set $regionEvent = {
active: false,
id: null,
x: null,
y: null,
duration: 0
}>>
<</widget>>
<<widget "GameUpdateWidget-018">>
<<include Items>>
<<include Potions>>
<<include PotionRecipes>>
<<include MerchantItems>>
<</widget>><<widget "updateDestinyStats">>
<<set $destinyatk = 0>>
<<set $destinydef = 0>>
<<set $destinycrit = 0>>
<<set $destinycritres = 0>>
<<set $destinyagility = 0>>
<<set $destinymartialArts = 0>>
<<set $destinyspiritualRoot = 0>>
<<set $righteousreputation = 0>>
<<set $demonicreputation = 0>>
<<set $destinylifespan = 0>>
<<set $destinyenergy = 0>>
<<set $destinyhealth = 0>>
<<for _d range $playerDestiny>>
<<if _d.destinyatk>> <<set $destinyatk += _d.destinyatk>> <</if>>
<<if _d.destinydef>> <<set $destinydef += _d.destinydef>> <</if>>
<<if _d.destinycrit>> <<set $destinycrit += _d.destinycrit>> <</if>>
<<if _d.destinycritres>> <<set $destinycritres += _d.destinycritres>> <</if>>
<<if _d.destinyagility>> <<set $destinyagility += _d.destinyagility>> <</if>>
<<if _d.destinymartialArts>> <<set $destinymartialArts += _d.destinymartialArts>> <</if>>
<<if _d.destinyspiritualRoot>> <<set $destinyspiritualRoot += _d.destinyspiritualRoot>> <</if>>
<<if _d.righteousreputation>> <<set $righteousreputation += _d.righteousreputation>> <</if>>
<<if _d.demonicreputation>> <<set $demonicreputation += _d.demonicreputation>> <</if>>
<<if _d.destinylifespan>> <<set $destinylifespan += _d.destinylifespan>> <</if>>
<<if _d.destinyenergy>> <<set $destinyenergy += _d.destinyenergy>> <</if>>
<<if _d.destinyhealth>> <<set $destinyhealth += _d.destinyhealth>> <</if>>
<</for>>
<<set $atk = $baseatk + $destinyatk>>
<<set $def = $basedef + $destinydef>>
<<set $crit = $basecrit + $destinycrit>>
<<set $critres = $basecritres + $destinycritres>>
<<set $agility = $baseagility + $destinyagility>>
<<set $martialArts = $basemartialArts + $destinymartialArts>>
<<set $spiritualRoot = $basespiritualRoot + $destinyspiritualRoot>>
<<set $maxlifespan to $basemaxlifespan + $destinylifespan>>
<<set $maxhealth to $basemaxhealth + $destinyenergy>>
<<set $maxenergy to $basemaxenergy + $destinyhealth>>
<<set $health = $maxhealth>>
<<set $energy = $maxenergy>>
<</widget>>
/* === UNIQUE CONSTITUTION GENERATION (xianxia style, every combo = different name) === */
<<widget "ConstitutionCalc">>
<<if $playerDestiny.length !== 3>>
<<set $constitutionName to "Incomplete Fate">>
<<set $constitutionDesc to "The Heavenly Dao cannot form your body. Exactly three destinies must converge before a true constitution can awaken.">>
<<else>>
/* Gather essences */
<<set _essences to []>>
<<for _d range $playerDestiny>>
<<set _essences.push(_d.essence)>>
<</for>>
/* Sort for stable keys */
<<set _sorted to _essences.sort()>>
<<set _key to _sorted.join("-")>>
/* ================================= */
/* LEGENDARY 3-DESTINY PHYSIQUES */
/* ================================= */
<<if _key === "Demonic-Demonic-Mind">>
<<set $constitutionName to "Abyssal Soul Devouring Physique">>
<<elseif _key === "Heaven-Heaven-Spirit">>
<<set $constitutionName to "Saintly Celestial Spirit Body">>
<<elseif _key === "Beast-Earth-Martial">>
<<set $constitutionName to "Primordial Titan War Body">>
<<elseif _key === "Fire-Heaven-Spirit">>
<<set $constitutionName to "Vermilion Phoenix Immortal Body">>
/* ================================= */
/* ELEMENTAL BODIES */
/* ================================= */
<<elseif _essences.includes("Fire") and _essences.includes("Ice")>>
<<set $constitutionName to "Primordial Yin-Yang Body">>
<<elseif _essences.includes("Fire")>>
<<set $constitutionName to "Blazing Vermilion Flame Physique">>
<<elseif _essences.includes("Ice")>>
<<set $constitutionName to "Frozen Jade Spirit Body">>
/* ================================= */
/* DEMONIC PATH */
/* ================================= */
<<elseif _essences.includes("Demonic")>>
<<set $constitutionName to "Nether Demon Devouring Body">>
/* ================================= */
/* HEAVENLY PATH */
/* ================================= */
<<elseif _essences.includes("Heaven")>>
<<set $constitutionName to "Heavenly Dao Blessed Physique">>
/* ================================= */
/* MARTIAL PATH */
/* ================================= */
<<elseif _essences.includes("Martial")>>
<<set $constitutionName to "Asura Martial War Body">>
/* ================================= */
/* BEAST PATH */
/* ================================= */
<<elseif _essences.includes("Beast")>>
<<set $constitutionName to "Ancient Beast Blood Physique">>
/* ================================= */
/* EARTH / BODY PATH */
/* ================================= */
<<elseif _essences.includes("Earth") or _essences.includes("Body")>>
<<set $constitutionName to "Titan Stone Physique">>
/* ================================= */
/* SPIRIT PATH */
/* ================================= */
<<elseif _essences.includes("Spirit")>>
<<set $constitutionName to "Celestial Spirit Vessel">>
/* ================================= */
/* FALLBACK */
/* ================================= */
<<else>>
<<set $constitutionName to "Myriad Dao Cultivation Body">>
<</if>>
/* ================================= */
/* PREFIX SYSTEM */
/* ================================= */
<<set _prefix to "">>
<<if $destinyspiritualRoot gte 15>>
<<set _prefix to "Heaven-Blessed ">>
<<elseif $demonicreputation gte 15>>
<<set _prefix to "Forbidden ">>
<<elseif $righteousreputation gte 15>>
<<set _prefix to "Saintly ">>
<</if>>
<<set $constitutionName to _prefix + $constitutionName>>
/* ================================= */
/* DESCRIPTION */
/* ================================= */
<<set $constitutionDesc to "Your meridians collapse and reform as the Heavenly Dao reshapes your body. The convergence of three destinies forges the " + $constitutionName >>
<</if>>
<</widget>>
<<widget "cultivationStatus">>
$cultivationStage $cultivationRealm
<</widget>>
<<widget "EnergyRecovery">>
<<if passage() is "Map|Region1">>
<<if $turns > $lastRecoveryTurn>>
<<set _EnergyRecovered = Math.round($maxenergy * $energyRecovery)>>
<<set $energy += _EnergyRecovered>>
<<if $energy > $maxenergy>><<set $energy = $maxenergy>><</if>>
<</if>>
<</if>>
<</widget>>
<<widget "HealthRecovery">>
<<if passage() is "Map|Region1">>
<<if $turns > $lastRecoveryTurn>>
<<set _HealthRecovered = Math.round($maxhealth * $healthRecovery)>>
<<set $health += _HealthRecovered>>
<<if $health > $maxhealth>><<set $health = $maxhealth>><</if>>
<</if>>
<</if>>
<</widget>>
<<widget "StatsRecovery">>
<<EnergyRecovery>>
<<HealthRecovery>>
<<set $lastRecoveryTurn = $turns>>
<</widget>>
<<widget "TurnsAge">>
/* Use State.variables to ensure we are looking at the exact same data the JS is touching */
<<if $turns gte $turnsPerYear>>
<<set $lifespan += 1>>
<<set $turns = 0>>
<<set _zodiacs to ["Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"]>>
<<set $currentZodiac to _zodiacs[$lifespan % 12]>>
<div class="age-announcement">
A year has passed. You are now $lifespan years old. It is the Year of the $currentZodiac.
</div>
<<if $known_npc_list and $known_npc_list.length gt 0>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<set _loopNPC to $known_npc_list[_i]>>
<<if !_loopNPC.isDead>>
/* Increment their current age */
<<set _loopNPC.NPClifespan += 1>>
/* Check against their max */
<<if _loopNPC.NPClifespan gt _loopNPC.NPCmaxlifespan>>
<<set _loopNPC.isDead to true>>
<<set _loopNPC.deathCause = "old_age">>
<<set _loopNPC.killedByPlayer = false>>
<<set _loopNPC.killedInRevenge = false>>
<<set _loopNPC.deathGrudgeType = null>>
<<set _loopNPC.deathGrudgeVictim = null>>
<</if>>
<</if>>
<</for>>
<</if>>
<</if>>
<<set $pe to 0>>
<<set $p to 0>>
<</widget>>
<<widget "MapRender">>
<<set $passage to passage()>>
<<set _tileSize = 50>>
<<set _x = $playerX * _tileSize>>
<<set _y = $playerY * _tileSize>>
<<if _x == 0>><<set _x = 1>><</if>>
<<if _y == 0>><<set _y = 1>><</if>>
<<if $activeSideMission neq null>>
<<set _sideMX = $activeSideMission.missionCordX * _tileSize>>
<<set _sideMY = $activeSideMission.missionCordY * _tileSize>>
<</if>>
<div id="map-container">
<<print '<div class="player-icon" style="left: ' + _x + 'px; top: ' + _y + 'px;"></div>'>>
<<if $SideMissionStatus == "accepted">>
<<print '<div class="sidemission-icon" style="left: ' + _sideMX + 'px; top: ' + _sideMY + 'px;"></div>'>>
<</if>>
<<if $regionEvent.active>>
<<set _eventX = $regionEvent.x * _tileSize>>
<<set _eventY = $regionEvent.y * _tileSize>>
<<print '<div class="random-event-icon" style="left: ' + _eventX + 'px; top: ' + _eventY + 'px;"></div>'>>
<</if>>
</div>
<</widget>>
<<widget "MissionNotification">>
<<if $activeSideMission neq null>>
<<if $playerX eq $activeSideMission.missionCordX and $playerY eq $activeSideMission.missionCordY>>
<span class="mission">You're on your mission location!</span>
<<link "Go!" "Mission|Region1">>
<</link>>
<</if>>
<</if>>
<</widget>>
<<widget "Movement">>
<<TurnsAge>>
<div id="movement-controls">
<<if $playerY > 2>>
<<link "↑ North">>
<<set $playerY -= 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>>
<<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
<<if $playerY < 13>>
<<link "↓ South">>
<<set $playerY += 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>><<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
<<if $playerX > 0>>
<<link "← West">>
<<set $playerX -= 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>><<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
<<if $playerX < 11>>
<<link "→ East">>
<<set $playerX += 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>><<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
</div>
<</widget>>
<<widget "statusCondition">>
<<showmeter "health">>
<<updatemeter "health" `$health / $maxhealth`>>
<<showmeter "energy">>
<<updatemeter "energy" `$energy / $maxenergy`>>
<div class="status">
<!-- HEALTH STATUS -->
<<if $health <= 0.1 * $maxhealth>>
<p><span class="wounded">⚠ You are on the brink of death!</span></p>
<<elseif $health <= 0.25 * $maxhealth>>
<p><span class="wounded">You are gravely wounded.</span></p>
<<elseif $health <= 0.5 * $maxhealth>>
<p><span class="wounded">You're bleeding and in pain.</span></p>
<<elseif $health <= 0.75 * $maxhealth>>
<p><span class="wounded">You're slightly injured.</span></p>
<<else>>
<p><span class="healthy">You're in good health.</span></p>
<</if>>
<!-- ENERGY (QI) STATUS -->
<<if $energy <= 0.1 * $maxenergy>>
<p><span class="drained">⚠ Your qi is nearly depleted!</span></p>
<<elseif $energy <= 0.25 * $maxenergy>>
<p><span class="drained">Your inner energy is dangerously low.</span></p>
<<elseif $energy <= 0.5 * $maxenergy>>
<p><span class="drained">Your qi circulation is weak.</span></p>
<<elseif $energy <= 0.75 * $maxenergy>>
<p><span class="drained">You feel a drain on your energy.</span></p>
<<else>>
<p><span class="focused">Your qi flows steadily.</span></p>
<</if>>
</div>
<</widget>>
<<widget "Breakthrough">>
<<set _realms = ["Mortal","Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set _stages = ["Early", "Middle", "Late"]>>
<<set _realmIndex = _realms.indexOf($cultivationRealm)>>
<<set _stageIndex = _stages.indexOf($cultivationStage)>>
<<set _baseExp = 1000>>
<<set _requiredExp = _baseExp * Math.pow(_realmIndex + 1, 2) * (_stageIndex + 1)>>
<<set _progress = Math.min(100, Math.round(($exp / _requiredExp) * 100))>>
<div style="border: 1px solid #777; padding: 1em; width: 90%; background: rgba(255,255,255,0.05); border-radius: 10px; font-family: 'serif'; color: #e0e0e0;">
<h3 style="margin: 0 0 0.5em 0; color: #8ff;">🧘 Cultivation Status</h3>
<p><strong>Stage:</strong> $cultivationStage<br>
<strong>Realm:</strong> $cultivationRealm</p>
<p><strong>EXP:</strong> <<print $exp.toFixed(1)>> / <<print _requiredExp>> (<<print _progress>>%)</p>
<div style="width: 100%; height: 20px; background: #333; border: 1px solid #666; border-radius: 5px; margin-bottom: 1em;">
<div style="width: <<print _progress>>%; height: 100%; background: linear-gradient(to right, #00f2ff, #4dffbf); border-radius: 5px;"></div>
</div>
<!-- Breakthrough Button -->
<<if $exp >= _requiredExp>>
<<link "🌌 Attempt Breakthrough" "Breakthrough1">><<set $exp to $exp - _requiredExp>> <</link>>
<<else>>
<p style="color:#ff6b6b; font-weight:bold; margin-top:20px;">
Not enough EXP to attempt breakthrough yet.
</p>
<</if>>
<</widget>>
<<widget "UpdatePlayerStats">>
<<set _multiplier to $args[0]>>
<<set $basemaxlifespan = Math.round($basemaxlifespan * _multiplier)>>
<<set $basemaxhealth = Math.round($basemaxhealth * _multiplier)>>
<<set $basemaxenergy = Math.round($basemaxenergy * _multiplier)>>
<<set $baseluck = Math.round($baseluck * _multiplier)>>
<<set $baseinsight = Math.round($baseinsight * _multiplier)>>
<<set $basebasestrength = Math.round($basebasestrength * _multiplier)>>
<<set $basebasewillpower = Math.round($basebasewillpower * _multiplier)>>
<<set $baseatk = Math.round($baseatk * _multiplier)>>
<<set $basedef = Math.round($basedef * _multiplier)>>
<<set $baseagility = Math.round($baseagility * _multiplier)>>
<<set $basemartialArts = Math.round($basemartialArts * _multiplier)>>
<<set $basespiritualRoot = Math.round($basespiritualRoot * _multiplier)>>
<</widget>>
<<widget "BreakthroughEvent">>
<<set _breakthroughOutcome = random(1, 100)>>
<<set _cancel = 0>>
<div class="outcome-box">
<<if _breakthroughOutcome lte 12>>
<!-- Qi Deviation - slightly rarer -->
<img src="images/Story/qideviation.png" width="60%" style="border-radius:12px; box-shadow:0 0 20px #ff6b6b;">
<p class="outcome-failure"><b>Qi Deviation!</b><br>Your meridians rebel in chaos. Blood sprays from your mouth as heavenly punishment strikes.</p>
<<set $health = Math.floor($health * 0.45)>>
<<set $energy = Math.floor($energy * 0.45)>>
<p>Your life hangs by a thread. <span class="red">Recover and try again.</span></p>
<<set _cancel = 1>>
<<LogEvent "cultivation" "Qi Deviation" "Your breakthrough attempt failed spectacularly. Your health and energy are heavily damaged." 2>>
<<elseif _breakthroughOutcome gt 12 and _breakthroughOutcome lte 78>>
<!-- Normal Breakthrough -->
<img src="images/Story/normal.png" width="60%" style="border-radius:12px; box-shadow:0 0 20px #66bb6a;">
<p class="outcome-success"><b>Breakthrough Successful!</b><br>Your qi surges forward like a calm river breaking a dam.</p>
<<set _multiplier = 1.28 + Math.random() * 0.12>> /* 1.28x ~ 1.40x */
<<else>>
<!-- Enlightenment - better rewards -->
<img src="images/Story/enlightenment.png" width="60%" style="border-radius:12px; box-shadow:0 0 20px gold;">
<p class="outcome-enlightenment"><b>Enlightenment Descends!</b><br>The Dao opens its eyes upon you. Power floods your body!</p>
<<set _multiplier = 1.45 + Math.random() * 0.15>> /* 1.45x ~ 1.60x */
<</if>>
<<if _cancel eq 1>>
<<link "Forfeit Attempt" "Breakthrough">>
<<set $exp -= random(150, 800)>>
<</link>>
<<else>>
<<set _realmIndex = $cultivationRealms.indexOf($cultivationRealm)>>
<<set _stageIndex = $cultivationStages.indexOf($cultivationStage)>>
<<run _stageIndex++>>
<<if _stageIndex gte $cultivationStages.length>>
<<set _stageIndex = 0>>
<<set _realmIndex++>>
<<if _realmIndex gte $cultivationRealms.length>>
<p class="outcome-enlightenment">You have reached the peak of known cultivation!</p>
<<LogEvent "cultivation" "Peak of Cultivation" "You have reached the absolute peak of known cultivation." 5>>
<<else>>
<<set $cultivationRealm = $cultivationRealms[_realmIndex]>>
<<set $cultivationStage = $cultivationStages[_stageIndex]>>
<p class="outcome-success">New Realm Achieved!<br><b>$cultivationRealm</b> ($cultivationStage)</p>
<</if>>
<<else>>
<<set $cultivationStage = $cultivationStages[_stageIndex]>>
<p class="outcome-success">New Stage Achieved!<br><b>$cultivationStage</b> $cultivationRealm</p>
<</if>>
<<if _cancel eq 0>>
<<link "Return" "Breakthrough">>
<!-- === MAIN STAT UPDATE - This is the key improvement === -->
<<UpdatePlayerStats _multiplier>>
<!-- Constitution bonus on breakthrough (very important for not falling behind) -->
<<if $constitutionName && $constitutionName.includes("Vermilion") || $constitutionName.includes("Blazing") || $constitutionName.includes("Flame")>>
<<set _constBonus = 1.12>> /* 12% extra for your flame physique */
<<elseif $constitutionName && $constitutionName.includes("Saintly") || $constitutionName.includes("Heaven")>>
<<set _constBonus = 1.10>>
<<else>>
<<set _constBonus = 1.06>>
<</if>>
<<set _finalMultiplier = _multiplier * _constBonus>>
/* Optional: extra boost when entering new realm */
<<if _stageIndex eq 0>>
<<set _finalMultiplier = _finalMultiplier * 1.18>>
<</if>>
<<set $playerPower = $power[$cultivationRealm][$cultivationStage] || 0>>
<<set _desc = "Breakthrough to " + $cultivationStage + " " + $cultivationRealm + ". Power surges dramatically.">>
<<LogEvent "breakthrough" "Advancement" _desc 4>>
<</link>>
<</if>>
<</if>>
</div>
<</widget>>
<<widget "HealthBar">>
<<if $currenthealth eq $maxhealth>><img src="Images/Icons/health10.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.9)>><img src="Images/Icons/health9.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.8)>><img src="Images/Icons/health8.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.7)>><img src="Images/Icons/health7.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.6)>><img src="Images/Icons/health6.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.5)>><img src="Images/Icons/health5.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.4)>><img src="Images/Icons/health4.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.3)>><img src="Images/Icons/health3.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.2)>><img src="Images/Icons/health2.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.1)>><img src="Images/Icons/health1.png" width=200 /><<else>><img src="Images/Icons/health0.png" width=200 /><</if>>
<</widget>>
<<widget "HeaderFooter">>
<<if $energy gt $maxenergy>> <<set $energy = $maxenergy>><</if>>
<<if $energy lt 0>> <<set $energy = 0>><</if>>
<<if $health gt $maxhealth>> <<set $health = $maxhealth>><</if>>
<</widget>>
<<widget "FameUpdater">>
<<set $totalPCrighteousreputation to $PCrighteousreputation + $righteousreputation>>
<<set $totalPCdemonicreputation to $PCdemonicreputation + $demonicreputation>>
<<set $totalFame to ($fame + $sectFame + $cultivationFame + $combatFame)>>
<</widget>>
<<widget "StatsUpdater">>
/* Base stats + destiny bonuses */
<<set $atk = $baseatk + $destinyatk + ($basestrength*0.5) + $passiveatk>>
<<set $def = $basedef + $destinydef + $passivedef>>
<<set $crit = $basecrit + $destinycrit + $passivecrit>>
<<set $critres = $basecritres + $destinycritres + $passivecritres>>
<<set $agility = $baseagility + $destinyagility + $passiveagility>>
<<set $martialArts = $basemartialArts + $destinymartialArts>>
<<set $spiritualRoot = $basespiritualRoot + $destinyspiritualRoot>>
/* Core stats */
<<set $luck = $baseluck>>
<<set $insight = $baseinsight>>
<<set $evadescore = Math.round(($agility * 2) + ($insight * 1.5) + ($luck * 0.5))>>
/* Max stats */
<<set $maxlifespan = $basemaxlifespan + $destinylifespan>>
<<set $maxhealth = Math.round($basemaxhealth + $destinyhealth)>>
<<set $maxenergy = Math.round($basemaxenergy + $destinyenergy)>>
/* ==================== EQUIPMENT BONUSES ==================== */
/* Reset equipment bonuses */
<<set $equipatk to 0>>
<<set $equipdef to 0>>
<<set $equipcrit to 0>>
<<set $equipcritres to 0>>
<<set $equipagility to 0>>
<<set $equipwillpower to 0>>
<<set $equipstrength to 0>>
<<set $equiparmor to 0>>
<<set $equipinsight to 0>>
/* Robe Bonuses */
<<if $equippedRobe neq null>>
<<if $equippedRobe.stats neq null>>
<<if $equippedRobe.stats.atk neq null>><<set $equipatk += $equippedRobe.stats.atk>><</if>>
<<if $equippedRobe.stats.def neq null>><<set $equipdef += $equippedRobe.stats.def>><</if>>
<<if $equippedRobe.stats.crit neq null>><<set $equipcrit += $equippedRobe.stats.crit>><</if>>
<<if $equippedRobe.stats.critres neq null>><<set $equipcritres += $equippedRobe.stats.critres>><</if>>
<<if $equippedRobe.stats.agility neq null>><<set $equipagility += $equippedRobe.stats.agility>><</if>>
<<if $equippedRobe.stats.willpower neq null>><<set $equipwillpower += $equippedRobe.stats.willpower>><</if>>
<<if $equippedRobe.stats.strength neq null>><<set $equipstrength += $equippedRobe.stats.strength>><</if>>
<<if $equippedRobe.stats.armor neq null>><<set $equiparmor += $equippedRobe.stats.armor>><</if>>
<<if $equippedRobe.stats.insight neq null>><<set $equipinsight += $equippedRobe.stats.insight>><</if>>
<</if>>
<</if>>
/* Underwear Bonuses */
<<if $equippedUnderwear neq null>>
<<if $equippedUnderwear.stats neq null>>
<<if $equippedUnderwear.stats.atk neq null>><<set $equipatk += $equippedUnderwear.stats.atk>><</if>>
<<if $equippedUnderwear.stats.def neq null>><<set $equipdef += $equippedUnderwear.stats.def>><</if>>
<<if $equippedUnderwear.stats.crit neq null>><<set $equipcrit += $equippedUnderwear.stats.crit>><</if>>
<<if $equippedUnderwear.stats.critres neq null>><<set $equipcritres += $equippedUnderwear.stats.critres>><</if>>
<<if $equippedUnderwear.stats.agility neq null>><<set $equipagility += $equippedUnderwear.stats.agility>><</if>>
<<if $equippedUnderwear.stats.willpower neq null>><<set $equipwillpower += $equippedUnderwear.stats.willpower>><</if>>
<<if $equippedUnderwear.stats.strength neq null>><<set $equipstrength += $equippedUnderwear.stats.strength>><</if>>
<<if $equippedUnderwear.stats.armor neq null>><<set $equiparmor += $equippedUnderwear.stats.armor>><</if>>
<<if $equippedUnderwear.stats.insight neq null>><<set $equipinsight += $equippedUnderwear.stats.insight>><</if>>
<</if>>
<</if>>
/* Weapon Bonuses */
<<if $equippedWeapon neq null>>
<<if $equippedWeapon.stats neq null>>
<<if $equippedWeapon.stats.atk neq null>><<set $equipatk += $equippedWeapon.stats.atk>><</if>>
<<if $equippedWeapon.stats.def neq null>><<set $equipdef += $equippedWeapon.stats.def>><</if>>
<<if $equippedWeapon.stats.crit neq null>><<set $equipcrit += $equippedWeapon.stats.crit>><</if>>
<<if $equippedWeapon.stats.critres neq null>><<set $equipcritres += $equippedWeapon.stats.critres>><</if>>
<<if $equippedWeapon.stats.agility neq null>><<set $equipagility += $equippedWeapon.stats.agility>><</if>>
<<if $equippedWeapon.stats.willpower neq null>><<set $equipwillpower += $equippedWeapon.stats.willpower>><</if>>
<<if $equippedWeapon.stats.strength neq null>><<set $equipstrength += $equippedWeapon.stats.strength>><</if>>
<<if $equippedWeapon.stats.armor neq null>><<set $equiparmor += $equippedWeapon.stats.armor>><</if>>
<<if $equippedWeapon.stats.insight neq null>><<set $equipinsight += $equippedWeapon.stats.insight>><</if>>
<</if>>
<</if>>
/* Accessories Bonuses (3 slots) */
<<if $equippedAccessories neq null>>
<<for _i to 0; _i lt 3; _i++>>
<<set _acc to $equippedAccessories[_i]>>
<<if _acc neq null>>
<<if _acc.stats neq null>>
<<if _acc.stats.atk neq null>><<set $equipatk += _acc.stats.atk>><</if>>
<<if _acc.stats.def neq null>><<set $equipdef += _acc.stats.def>><</if>>
<<if _acc.stats.crit neq null>><<set $equipcrit += _acc.stats.crit>><</if>>
<<if _acc.stats.critres neq null>><<set $equipcritres += _acc.stats.critres>><</if>>
<<if _acc.stats.agility neq null>><<set $equipagility += _acc.stats.agility>><</if>>
<<if _acc.stats.willpower neq null>><<set $equipwillpower += _acc.stats.willpower>><</if>>
<<if _acc.stats.strength neq null>><<set $equipstrength += _acc.stats.strength>><</if>>
<<if _acc.stats.armor neq null>><<set $equiparmor += _acc.stats.armor>><</if>>
<<if _acc.stats.insight neq null>><<set $equipinsight += _acc.stats.insight>><</if>>
<</if>>
<</if>>
<</for>>
<</if>>
/* ==================== FINAL STATS WITH EQUIPMENT ==================== */
<<set $atk += $equipatk>>
<<set $def += $equipdef>>
<<set $crit += $equipcrit>>
<<set $critres += $equipcritres>>
<<set $agility += $equipagility>>
<<set $willpower = $basewillpower + $equipwillpower>> /* Add willpower if you have $willpower stat */
<<set $strength = $basestrength + $equipstrength>> /* Add strength if needed */
<<set $armor = $equiparmor>> /* New armor stat if you use it */
<<set $insight += $equipinsight>>
/* Recalculate evade if affected */
<<set $evadescore = Math.round(($agility * 2) + ($insight * 1.5) + ($luck * 0.5))>>
<</widget>>
<<widget "MissionFinish">>
<<if $MissionType eq "sect">>
<<set $ContributionPoints to ($ContributionPoints += $activeSideMission.reward)>>
<<set $CurrentPcSectReputation to ($CurrentPcSectReputation += $activeSideMission.gainFame)>>
<<set $sectFavor to ($sectFavor += $activeSideMission.favor)>>
<span class="mission"> <i>✓ Mission completed successfully.</i> </span>
<<link "Go back" $passage>><<set $pe to 0>><<set $activeSideMission to null>><<set $SideMissionStatus to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<<else>>
<span class="mission"> <i>✓ Mission completed successfully.</i> </span>
<<set $gold to ($gold += $activeSideMission.reward)>>
<<set $fame to ($fame += $activeSideMission.gainFame)>>
<<link "Go back" $passage>><<set $pe to 0>><<set $SideMissionStatus to null>><<set $activeSideMission to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<</if>>
<</widget>>
<<widget "MissionFinishAuto">>
<<if $MissionType eq "sect">>
<<set $ContributionPoints to ($ContributionPoints += $activeSideMission.reward)>>
<<set $CurrentPcSectReputation to ($CurrentPcSectReputation += $activeSideMission.gainFame)>>
<<set $sectFavor to ($sectFavor += $activeSideMission.favor)>>
<span class="mission"> <i>✓ Mission completed successfully.</i> </span>
<<set $pe to 0>><<set $activeSideMission to null>><<set $SideMissionStatus to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>>
<<else>>
<span class="mission"> <i>✓ Mission completed successfully.</i> </span>
<<set $gold to ($gold += $activeSideMission.reward)>>
<<set $fame to ($fame += $activeSideMission.gainFame)>>
<<set $pe to 0>><<set $SideMissionStatus to null>><<set $activeSideMission to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>>
<</if>>
<</widget>>
<<widget "MissionFailed">>
<<if $MissionType eq "sect">>
<span class="mission"> <i>✗ Mission failed!</i> </span>
<<link "Go back" $passage>><<set $pe to 0>><<set $activeSideMission to null>><<set $SideMissionStatus to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<<else>>
<span class="mission"> <i>✗ Mission failed!</i> </span>
<<link "Go back" $passage>><<set $pe to 0>><<set $SideMissionStatus to null>><<set $activeSideMission to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<</if>>
<</widget>>
<<widget "PositionCheckSex">>
<<if $cumcount >= 3>>
<<set _roll = random(1, 100)>>
<<if _roll <= 25>>
<<set $npcFinished = true>>
<p>He suddenly groans and releases deep inside without warning!</p>
<</if>>
<<if not $npcFinished>>
<p>He's close. Where do you want him to finish?</p>
<<link "Inside">>
<p>You pull him deeper and feel him release inside you.</p>
<</link>>
<<link "Outside">>
<p>You pull back just in time — he spills over your stomach.</p>
<</link>>
<<link "On your back">>
<p>You drop to your knees, and he finishes across your back.</p>
<</link>>
<</if>>
<</if>>
<</widget>>
<!-- Portrait updater -->
<<widget "UpdatePortrait">>
<div class="portrait-container">
<<set _img to "images/Character/bare.jpg">>
<<if $equippedRobe.name neq "Naked State" and $equippedRobe.durability neq null>>
<<set _dur to $equippedRobe.durability>>
<<set _maxDur to $equippedRobe.maxDurability>>
<<if _dur gt (_maxDur * 0.5)>>
<<set _img to "images/Character/pristine.jpg">>
<<elseif _dur gt (_maxDur * 0.2)>>
<<set _img to "images/Character/torn.jpg">>
<<else>>
<<set _img to "images/Character/bare.jpg">>
<</if>>
<</if>>
<img @src="_img" class="portrait-img">
</div>
<</widget>>
<<widget "StatusPortrait">>
<div class="status-portrait-container">
<<set _img to "images/Character/bare.jpg">>
<<if $equippedRobe.name neq "Naked State" and $equippedRobe.durability neq null>>
<<set _dur to $equippedRobe.durability>>
<<set _maxDur to $equippedRobe.maxDurability>>
<<if _dur gt (_maxDur * 0.5)>>
<<set _img to "images/Character/pristine.jpg">>
<<elseif _dur gt (_maxDur * 0.2)>>
<<set _img to "images/Character/torn.jpg">>
<<else>>
<<set _img to "images/Character/bare.jpg">>
<</if>>
<</if>>
<img @src="_img" class="status-portrait-img">
</div>
<</widget>>
<!-- Arena Tournament Widget -->
??
<!--__________________________________________________________________________________________
_________________________ Rumours Widgets _________________________-->
<<widget "WorldRumours">>
/* 1. THE AGING PROCESS: Subtract 1 from any active event timers */
<<if $worldState.activeWar>>
<<set $worldState.activeWar.remaining -= 1>>
/* If timer hits 0, the war ends */
<<if $worldState.activeWar.remaining lte 0>>
<div class="rumour-event">
<strong>◎ Jianghu News ◎</strong><br>
The bloody conflict between the <<print $worldState.activeWar.sideA>> and <<print $worldState.activeWar.sideB>> has finally concluded. A fragile peace returns... for now.
</div>
<<set $worldState.activeWar to null>>
<</if>>
<</if>>
/* 2. TRIGGER NEW RUMOURS (20% chance) */
<<if random(1, 100) lte 20>>
<<set _rumourCategory to random(1, 100)>>
<<set _text to "">>
<<switch _rumourCategory>>
/* --- 1–20: SECT WAR LOGIC --- */
<<case 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20>>
<<if $worldState.activeWar>>
/* Report on the CURRENT war */
<<set _text to `The fields are stained red as the war between **$worldState.activeWar.sideA** and **$worldState.activeWar.sideB** enters another month. ($worldState.activeWar.remaining turns until exhaustion).`>>
<<else>>
/* Start a NEW war */
<<set _sects to ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect", "Five Elements Holy Land", "Profound Heaven Sword Alliance"].randomMany(2)>>
/* A war lasts between 1/2 year (12 turns) and 1.5 years (36 turns) */
<<set _duration to random(12, 36)>>
<<set $worldState.activeWar to {
sideA: _sects[0],
sideB: _sects[1],
remaining: _duration
}>>
<<if _sects.includes($playerSect)>>
<<set _text to `**URGENT:** Your sect, ${_sects.find(s => s === $playerSect)}, has declared war! The elders demand blood from the ${_sects.find(s => s !== $playerSect)}!`>>
<<else>>
<<set _text to `The **${_sects[0]}** and **${_sects[1]}** have officially begun a Great Sect War. The region is in chaos.`>>
<</if>>
<</if>>
/* --- 16–30: THE "BORN GENIUS" / SECT POLITICS --- */
<<case 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30>>
<<set _name to ["Young Master Xiao", "Fairy Lingyue", "Sword Madman Huo", "Ghost Hand Xue", "Elder Han's Bastard"].random()>>
<<set _sect to ["Heavenly Sword Sect", "Jade Pure Palace", "Blood Flame Clan"].random()>>
<<if _sect === $playerSect>>
<<set _text to [
`Whispers in the outer courts: **_name** has successfully refined a 'Heart-Severing Pill'. The screams from the dungeon have finally stopped.`,
`Internal politics: Your fellow disciple **_name** was found with a crippled cultivation base. The Elders are calling it 'meditation backfire,' but everyone saw the marks of a forbidden technique.`,
`Promotion: **_name** has been granted the title of Core Disciple. Three other candidates disappeared during the 'selection trial'.`
].random()>>
<<else>>
<<set _text to [
`The **_sect** is hunting for **_name**, a runaway disciple who allegedly stole a fragment of their foundational scripture. A bounty of 10,000 spirit stones—dead or alive.`,
`Travelers claim the **_sect** has blockaded the nearby mountain passes. They are 'testing' the spiritual roots of every traveler; those who fail are sent to the mines.`,
`Rumor has it **_name** of the **_sect** slaughtered an entire branch family of a vassal clan for a 'slight' to their dignity. The blood hasn't washed off the stones yet.`
].random()>>
<</if>>
/* --- 31–45: ANCIENT RUINS & DESOLATION --- */
<<case 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45>>
<<set _zone to ["Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _text to [
`The seal on **_zone** has fractured. A miasma of ancient resentment is drifting toward the mortal plains; three villages have already gone silent.`,
`Scouts returned from **_zone** with their eyes gouged out. They keep chanting about an 'Immortal's Grave' that isn't empty.`,
`The Righteous Path has established a perimeter around **_zone**. They claim it is for 'public safety,' but the wagon-loads of looted artifacts tell a different story.`,
`A pulse of dark energy erupted from **_zone**. The local wildlife has mutated, growing teeth of obsidian and a hunger for spiritual qi.`
].random()>>
/* --- 46–60: MARKET & THE COST OF POWER --- */
<<case 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60>>
<<set _text to [
"Spirit stone purity is dropping across the southern markets. Rumors suggest the Great Veins are being over-mined to fund the upcoming war.",
"The black market is flooded with 'Blood Essence' vials. Local graveyards have been desecrated, leading many to suspect a demonic sect is harvesting the dead.",
"A merchant caravan was found slaughtered near the border. Not a single spirit stone was taken—only the children's 'spiritual roots' were harvested.",
"The price of Foundation Establishment Pills has tripled. Small clans are selling their daughters into sect servitude just to afford a single chance at a breakthrough."
].random()>>
/* --- 61–100: GENERAL FLAVOR & OMINOUS MYSTERIES --- */
<<default>>
<<set _text to [
"A wandering cultivator was found hanging from the gates of a mortal city, his skin covered in forbidden seals. A warning from the Ghost King's men.",
"Old Man He from the fishing village says the river ran red for three hours yesterday. He saw shadows beneath the water that didn't belong to fish.",
"A group of rogue cultivators 'purified' a village of suspected plague. They burned it to the ground with the inhabitants still inside.",
"Eerie flutes are heard at night in the pine forests. Those who follow the music are found days later with their souls missing and their bodies intact.",
"A 'Saintess' has appeared in the slums, performing miracles. The local sect is preparing to 'arrest' her for heresy—or perhaps to steal her cultivation method.",
"The sky turned a bruised purple for ten heartbeats today. The birds fell dead from the trees, and the oxen refused to plow."
].random()>>
<</switch>>
/* 3. FINAL OUTPUT */
<<if _text neq "">>
<div class="rumour-event">
<strong>◎ Jianghu Whispers ◎</strong>
<<if _severity is "shocking">><span style="color: #c41e3a;"> (Shocking!)</span><</if>>
<<if $worldState.activeWar>><br><small><i>[STATE: War in Progress]</i></small><</if>>
<br>_text
</div>
<</if>>
<</if>>
<</widget>>
<<widget "TavernGossip">>
<div class="rumour-box" style="border-left: 3px solid #d4af37; padding-left: 10px; margin: 10px 0; background: rgba(255,255,255,0.05);">
<i style="color: #aaa;">You lean back and sharpen your senses, filtering through the clatter of chopsticks and the slurred boasts of drunken men...</i><br><br>
/* Call your existing logic */
<<WorldRumours>>
/* If WorldRumours didn't trigger (the 20% chance), give a default "quiet" message */
<<if _text eq "" or _text eq undefined>>
<span style="color: #888;">The conversations tonight are mundane—mostly complaints about the price of low-grade grain and local tax collectors.</span>
<</if>>
</div>
<</widget>>
<<widget "LogEvent">>
<<set _type to $args[0]>>
<<set _title to $args[1]>>
<<set _description to $args[2]>>
<<set _importance to $args[3] || 3>>
<<set _relatedNPC to $args[4] || null>>
<<set _relatedNPCName to $args[5] || null>>
<<set _entry = {
id: $nextJournalId,
turn: $turns || 0,
age: $lifespan,
type: _type,
title: _title,
description: _description,
importance: _importance,
relatedNPC: _relatedNPC,
relatedNPCName: _relatedNPCName,
location: $region,
timestamp: Date.now()
}>>
<<run $journalEntries.unshift(_entry)>>
<<set $nextJournalId += 1>>
/* Optional: limit journal size to prevent bloat (keep last 200 entries) */
<<if $journalEntries.length gt 200>>
<<run $journalEntries.pop()>>
<</if>>
<</widget>><<widget "GenerateGrudge">>
<<set _victim to $args[0]>>
<<set _action to $args[1]>>
<<set _avengerId to $args[2] || null>>
/* Determine who seeks revenge */
<<set _avenger to null>>
<<set _relationship to "">>
<<if _avengerId>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _avengerId; })>>
<<else>>
/* Find a relative or close connection */
<<set _potentialAvengers to []>>
/* Check all known NPCs for relations to victim */
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<set _npc to $known_npc_list[_i]>>
<<if _npc.id != _victim.id and !_npc.isDead>>
<<if _npc.relations.lovers and _npc.relations.lovers.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "lover"})>>
<</if>>
<<if _npc.relations.spouses and _npc.relations.spouses.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "spouse"})>>
<</if>>
<<if _npc.relations.parents and _npc.relations.parents.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "child"})>>
<</if>>
<<if _npc.relations.children and _npc.relations.children.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "parent"})>>
<</if>>
<<if _npc.relations.siblings and _npc.relations.siblings.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "sibling"})>>
<</if>>
<<if _npc.relations.masters and _npc.relations.masters.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "disciple"})>>
<</if>>
<<if _npc.relations.apprentices and _npc.relations.apprentices.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "master"})>>
<</if>>
<</if>>
<</for>>
<<if _potentialAvengers.length gt 0>>
<<set _selected = _potentialAvengers.random()>>
<<set _avenger = _selected.npc>>
<<set _relationship = _selected.rel>>
<</if>>
<</if>>
<<if _avenger>>
/* Calculate severity based on action and victim's cultivation */
<<set _severity = 0>>
<<switch _action>>
<<case "rape">>
<<set _severity = 8 + Math.floor(Math.random() * 3)>>
<<set _avenger.depravity += 5>>
<<set $demonicreputation += 15>>
<<set $hypocrisyScore += 10>>
<<case "seduction">>
<<set _severity = 3 + Math.floor(Math.random() * 3)>>
<<set $sexFame += 5>>
<<case "murder">>
<<set _severity = 10>>
<<set $demonicreputation += 20>>
<<set $civilians_harmed += 1>>
<<case "humiliation">>
<<set _severity = 2 + Math.floor(Math.random() * 4)>>
<<set $fame -= 5>>
<<case "betrayal">>
<<set _severity = 5 + Math.floor(Math.random() * 3)>>
<<set $hypocrisyScore += 5>>
<</switch>>
/* Create grudge object */
<<set _grudge = {
id: Date.now() + "_" + random(0, 9999),
avengerId: _avenger.id,
avengerName: _avenger.fullname,
victimId: _victim.id,
victimName: _victim.fullname,
type: _action,
severity: _severity,
relationship: _relationship,
location: _victim.NPClocation,
triggered: false,
active: true,
hasGrudge: true,
timer: random(3, 7) /* turns before they act*/
}>>
<<run $activeGrudges.push(_grudge)>>
/* Update avenger's stats */
<<set _avenger.hasGrudge = true>>
<<set _avenger.grudgeTarget = "player">>
<<set _avenger.grudgeType = _action>>
/* Generate message for player */
<<set _grudgeMessage = "✦ A shadow stirs in " + _victim.NPClocation + ". " + _avenger.fullname + " seeks justice for what you did to " + _victim.fullname + "! ✦">>
<<set $lastGrudgeMessage = _grudgeMessage>>
<</if>>
<</widget>>
<<widget "CheckRevengeEvents">>
<<if def $activeGrudges and $activeGrudges.length gt 0>>
<<set _revengeTriggered to false>>
/* Using range to avoid index errors */
<<for _index, _grudge range $activeGrudges>>
<<if _grudge.active and !_grudge.triggered and !_revengeTriggered>>
<<set _grudge.timer -= 1>>
<<if _grudge.timer lte 0>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _grudge.avengerId; })>>
<<if _avenger and !_avenger.isDead>>
/* High power NPCs can hunt you across regions! */
<<set _isPowerful to (_avenger.power gt 100)>>
<<set _locationMatch to (_avenger.NPClocation == $region or _grudge.location == $region or _isPowerful)>>
<<set _chance to 15 + (_grudge.severity * 5)>>
<<if _locationMatch>><<set _chance += 25>><</if>>
/* Debug: <<print "Checking grudge for " + _avenger.fullname + " Chance: " + _chance>> */
<<if random(1,100) lte _chance>>
<<set _revengeTriggered to true>>
<<set _grudge.triggered to true>>
<<set $currentRevengeGrudge to _grudge>>
<<set $encounterOriginPassage to passage()>>
<<goto "RevengeEncounter">>
<</if>>
<<else>>
/* If avenger died elsewhere, deactivate the grudge */
<<set _grudge.active to false>>
<</if>>
<</if>>
<</if>>
<</for>>
/* Cleanup: Periodically remove inactive grudges from the array */
<<set $activeGrudges to $activeGrudges.filter(function(g) { return g.active === true; })>>
<</if>>
<</widget>><<widget "setupInn">>
<<set _regionalCost to ($currentRegion eq "Region1" ? 1 : 1.5)>>
<<set $innStayCost to 50 * _regionalCost>>
<<set $roomAvailable to random(1, 100)>>
<</widget>>
<<widget "restEffect">>
<<set $health to $maxhealth>>
<<set $energy to $maxenergy>>
<<set $gold -= $innStayCost>>
<<set $currentPhase to "🌅 Dawn">>
<</widget>>
<<widget "EraTracker">>
<<set _solarTerms to [
"Start of Spring", "Rain Water", "Insects Awaken", "Spring Equinox",
"Clear and Bright", "Grain Rain", "Start of Summer", "Grain Buds",
"Grain in Ear", "Summer Solstice", "Minor Heat", "Major Heat",
"Start of Autumn", "End of Heat", "White Dew", "Autumn Equinox",
"Cold Dew", "Frost's Descent", "Start of Winter", "Minor Snow",
"Major Snow", "Winter Solstice", "Minor Cold", "Major Cold"
]>>
<<set _zodiacs to [
"🐀 Rat", "🐂 Ox", "🐅 Tiger", "🐇 Rabbit", "🐉 Dragon", "🐍 Snake",
"🐎 Horse", "🐐 Goat", "🐒 Monkey", "🐓 Rooster", "🐕 Dog", "🐖 Pig"
]>>
<<set _eras to [
"Primordial Chaos", "Ascendant Dragon", "Jade Emperor", "Falling Stars",
"Crimson Calamity", "Ten Thousand Swords", "Divine Lotus", "Shattered Heavens",
"Mortal Dust", "Void Spark"
]>>
<<set _timePhases to ["🌅 Dawn", "☀️ Zenith", "🌇 Twilight", "🌙 Midnight"]>>
/* Use Math.floor for display so fractional turns don't cause visual flickering */
<<set _wholeTurns to Math.floor($turns)>>
<<set $currentPhase to _timePhases[Math.floor($turns * (4 / $turnsPerYear)) % 4]>>
<<set $currentTerm to _solarTerms[_wholeTurns % 24]>>
<<set $currentZodiac to _zodiacs[$lifespan % 12]>>
<<set _eraIndex to Math.floor($lifespan / 100) % _eras.length>>
<<set $currentEra to _eras[_eraIndex]>>
<<set $eraYear to ($lifespan % 100) + 1>>
/* Progress as percentage of year, floored to whole percent */
<<set _yearProgress to Math.floor(($turns / $turnsPerYear) * 100)>>
<div class="time-era-section">
<span class="time-era-label">📜 Record of Heavens</span>
<div class="time-era-year">Year $eraYear of the $currentEra Era</div>
<div class="time-era-zodiac">Year of the $currentZodiac</div>
<div class="time-era-season">$currentPhase | $currentTerm</div>
<progress id="year-progress" value="<<print _yearProgress>>" max="100"></progress>
<div class="time-era-cycle"><<print _yearProgress>>% through the year</div>
</div>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
REALM & POWER MAPPING SYSTEM
Uses the same power scale as player stats
═════════════════════════════════════════════════════════════ -->
<<set setup.powerToRealm = {
0: {realm: "Mortal", stage: ""},
10: {realm: "Body Tempering Realm", stage: "Early"},
11: {realm: "Body Tempering Realm", stage: "Middle"},
12: {realm: "Body Tempering Realm", stage: "Late"},
20: {realm: "Meridian Awakening Realm", stage: "Early"},
21: {realm: "Meridian Awakening Realm", stage: "Middle"},
22: {realm: "Meridian Awakening Realm", stage: "Late"},
30: {realm: "Qi Condensation Realm", stage: "Early"},
31: {realm: "Qi Condensation Realm", stage: "Middle"},
32: {realm: "Qi Condensation Realm", stage: "Late"},
40: {realm: "Foundation Establishment Realm", stage: "Early"},
41: {realm: "Foundation Establishment Realm", stage: "Middle"},
42: {realm: "Foundation Establishment Realm", stage: "Late"},
50: {realm: "Core Formation Realm", stage: "Early"},
51: {realm: "Core Formation Realm", stage: "Middle"},
52: {realm: "Core Formation Realm", stage: "Late"},
60: {realm: "Nascent Soul Realm", stage: "Early"},
61: {realm: "Nascent Soul Realm", stage: "Middle"},
62: {realm: "Nascent Soul Realm", stage: "Late"}
}>>
<<set setup.allPowers = [0, 10, 11, 12, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51, 52, 60, 61, 62]>>
<<widget "getDangerDisplay">>
<<set _danger to $args[0]>>
<<switch _danger>>
<<case 1>>☠️
<<case 2>>☠️☠️
<<case 3>>☠️☠️☠️
<<case 4>>☠️☠️☠️☠️
<<case 5>>☠️☠️☠️☠️☠️
<<default>>
<</switch>>
<</widget>>
<<widget "calculateEnemyPower">>
<<set _dangerLevel to $args[0]>>
/* Fallback check for missing player power matrices */
<<if $power and $power[$cultivationRealm] and $power[$cultivationRealm][$cultivationStage] neq undefined>>
<<set _playerPower to $power[$cultivationRealm][$cultivationStage]>>
<<else>>
<<set _playerPower to 10>> /* Default safely to Early Body Tempering */
<</if>>
<<set _dangerToPowerOffset to { 1: 0, 2: 10, 3: 20, 4: 30, 5: 40 }>>
<<set _offset to _dangerToPowerOffset[_dangerLevel] ?? 10>>
<<set _variationRoll to random(-5, 5)>>
<<set _enemyPower to _playerPower + _offset + _variationRoll>>
<<set _enemyPower to Math.max(0, Math.min(62, _enemyPower))>>
<<set _nearest to _enemyPower>>
<<set _minDist to 999>>
<<for _p range setup.allPowers>>
<<set _dist to Math.abs(_p - _enemyPower)>>
<<if _dist < _minDist>>
<<set _minDist to _dist>>
<<set _nearest to _p>>
<</if>>
<</for>>
<<print _nearest>>
<</widget>>
<<widget "getRealmsFromPower">>
<<set _power to $args[0]>>
<<if setup.powerToRealm[_power]>>
<<set _missionRealm to setup.powerToRealm[_power].realm>>
<<set _missionStage to setup.powerToRealm[_power].stage>>
<<else>>
<<set _missionRealm to "Unknown">>
<<set _missionStage to "">>
<</if>>
<</widget>>
<<widget "calculateActualDanger">>
<<set _base to $args[0]>>
<<set _var to $args[1]>>
<<set _roll to random(-_var, _var)>>
<<set _actual to Math.max(1, Math.min(5, _base + _roll))>>
<<print _actual>>
<</widget>>
<!-- ═════════════════════════════════════════════════════════════
REFRESHMISSIONS WITH CONFIGURABLE MISSION LIMIT
═════════════════════════════════════════════════════════════ -->
<<widget "refreshMissions">>
<<include "SideMissions">>
<!-- Initialize if missing -->
<<if !$allPowers>>
<<set $allPowers = [0, 10, 11, 12, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51, 52, 60, 61, 62]>>
<</if>>
<<if !$powerToRealm>>
<<set $powerToRealm = {
0: {realm: "Mortal", stage: ""},
10: {realm: "Body Tempering Realm", stage: "Early"},
11: {realm: "Body Tempering Realm", stage: "Middle"},
12: {realm: "Body Tempering Realm", stage: "Late"},
20: {realm: "Meridian Awakening Realm", stage: "Early"},
21: {realm: "Meridian Awakening Realm", stage: "Middle"},
22: {realm: "Meridian Awakening Realm", stage: "Late"},
30: {realm: "Qi Condensation Realm", stage: "Early"},
31: {realm: "Qi Condensation Realm", stage: "Middle"},
32: {realm: "Qi Condensation Realm", stage: "Late"},
40: {realm: "Foundation Establishment Realm", stage: "Early"},
41: {realm: "Foundation Establishment Realm", stage: "Middle"},
42: {realm: "Foundation Establishment Realm", stage: "Late"},
50: {realm: "Core Formation Realm", stage: "Early"},
51: {realm: "Core Formation Realm", stage: "Middle"},
52: {realm: "Core Formation Realm", stage: "Late"},
60: {realm: "Nascent Soul Realm", stage: "Early"},
61: {realm: "Nascent Soul Realm", stage: "Middle"},
62: {realm: "Nascent Soul Realm", stage: "Late"}
}>>
<</if>>
<<set _missionArray to []>>
<<set _missionLimit to 0>>
<<if $sidemissions>>
/* TOWN MISSIONS - Show 4 missions */
<<set _missionLimit to 3>>
<<set _pool to $sidemissions.filter(m => m.region === $currentRegion)>>
<<set _missionArray to _pool.sort(() => 0.5 - Math.random())>>
<<elseif $SectSideMissions>>
/* SECT MISSIONS - Show 3 missions */
<<set _missionLimit to 3>>
<<set _currentRankIndex to $sectRanks.indexOf($CurrentPcSectRank)>>
<<set _pool to $SectSideMissions.filter(m => {
if (!m.requiredRank) return true;
return $sectRanks.indexOf(m.requiredRank) <= _currentRankIndex;
})>>
<<set _missionArray to _pool.sort(() => 0.5 - Math.random())>>
<</if>>
/* Process missions - use dynamic limit */
<<set $visibleMissions to []>>
<<for _i to 0; _i < _missionLimit && _i < _missionArray.length; _i++>>
<<set _mission to _missionArray[_i]>>
<!-- Handle different combat statuses -->
<<if _mission.isCombat eq true>>
<!-- KNOWN COMBAT: Calculate danger and enemy -->
<<set _baseDanger to _mission.dangerLevel ?? 2>>
<<set _dangerVariation to 1>>
<<set _dangerRoll to random(-_dangerVariation, _dangerVariation)>>
<<set _mission.actualDangerLevel to Math.max(1, Math.min(5, _baseDanger + _dangerRoll))>>
<!-- Calculate enemy power and realm -->
<<set _playerPower to $power[$cultivationRealm][$cultivationStage]>>
<<set _dangerToPowerOffset to {
1: 0,
2: 10,
3: 20,
4: 30,
5: 40
}>>
<<set _offset to _dangerToPowerOffset[_mission.actualDangerLevel]>>
<<set _variance to random(-5, 5)>>
<<set _enemyPower to _playerPower + _offset + _variance>>
<<set _enemyPower to Math.max(0, Math.min(62, _enemyPower))>>
<!-- Find nearest valid power level -->
<<set _nearest to 10>>
<<set _minDist to 999>>
<<for _p range $allPowers>>
<<set _dist to Math.abs(_p - _enemyPower)>>
<<if _dist < _minDist>>
<<set _minDist to _dist>>
<<set _nearest to _p>>
<</if>>
<</for>>
<!-- Get realm and stage -->
<<getRealmsFromPower _nearest>>
<<set _mission.estimatedPower to _nearest>>
<<set _mission.estimatedRealm to _missionRealm>>
<<set _mission.estimatedStage to _missionStage>>
<<set _mission.enemyRealm to _missionRealm>>
<<set _mission.enemyStage to _missionStage>>
<<elseif _mission.isCombat eq "unknown">>
<!-- UNKNOWN COMBAT: Randomly decide if there's actually an enemy -->
<<set _combatChance to random(1, 100)>>
<!-- 50% chance to have combat, 50% chance to have none -->
<<if _combatChance lte 50>>
<<set _mission.hasUnexpectedCombat to true>>
<!-- Calculate danger (but don't reveal it) -->
<<set _baseDanger to _mission.dangerLevel ?? 2>>
<<set _dangerVariation to 1>>
<<set _dangerRoll to random(-_dangerVariation, _dangerVariation)>>
<<set _mission.actualDangerLevel to Math.max(1, Math.min(5, _baseDanger + _dangerRoll))>>
<!-- Calculate enemy (but don't show it until mission starts) -->
<<set _playerPower to $power[$cultivationRealm][$cultivationStage]>>
<<set _dangerToPowerOffset to {1: 0, 2: 10, 3: 20, 4: 30, 5: 40}>>
<<set _offset to _dangerToPowerOffset[_mission.actualDangerLevel]>>
<<set _variance to random(-5, 5)>>
<<set _enemyPower to _playerPower + _offset + _variance>>
<<set _enemyPower to Math.max(0, Math.min(62, _enemyPower))>>
<<set _nearest to 10>>
<<set _minDist to 999>>
<<for _p range $allPowers>>
<<set _dist to Math.abs(_p - _enemyPower)>>
<<if _dist < _minDist>>
<<set _minDist to _dist>>
<<set _nearest to _p>>
<</if>>
<</for>>
<<getRealmsFromPower _nearest>>
<<set _mission.hiddenEnemyPower to _nearest>>
<<set _mission.hiddenEnemyRealm to _missionRealm>>
<<set _mission.hiddenEnemyStage to _missionStage>>
<<else>>
<<set _mission.hasUnexpectedCombat to false>>
<<set _mission.actualDangerLevel to null>>
<</if>>
<!-- Display as ??? -->
<<set _mission.estimatedRealm to "???">>
<<set _mission.estimatedStage to "???">>
<<set _mission.estimatedPower to null>>
<<else>>
<!-- NOT COMBAT: No enemy, no danger -->
<<set _mission.actualDangerLevel to null>>
<<set _mission.estimatedRealm to null>>
<<set _mission.estimatedStage to null>>
<<set _mission.estimatedPower to null>>
<</if>>
<<set $visibleMissions.push(_mission)>>
<</for>>
/* Reset mission state */
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<</widget>><<widget "gainRandomItem">>
<<set _item = clone(either(...$itemList))>>
<<set _exists = false>>
<<for _i = 0; _i < $playeriteminventory.length; _i++>>
<<if $playeriteminventory[_i].name == _item.name>>
<<set $playeriteminventory[_i].quantity += 1>>
<<set _exists = true>>
<<break>>
<</if>>
<</for>>
<<if not _exists>>
<<set _item.quantity += 1>>
<<set $playeriteminventory.push(_item)>>
<</if>>
<</widget>>
<<widget "AddItemToInventory">>
<<set _found = false>>
<<for _item range $playeriteminventory>>
<<if _item.name == _args[0].name>>
<<set _item.quantity += 1>>
<<set _found = true>>
<</if>>
<</for>>
<<if not _found>>
<<set _newItem = clone(_args[0])>>
<<set _newItem.quantity = 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
<</widget>>
<<widget "craftItem">>
<<set _recipe = _args[0]>>
<<set _canCraft = true>>
<!-- Check to see if enough ingredients -->
<<for _id, _qty range _recipe.ingredients>>
<<set _found = $playeriteminventory.find(function(item) { return item.name == _id })>>
<<if !_found or _found.quantity < _qty>> <!-- If not enough ingredients -->
<<set _canCraft = false>>
<</if>>
<</for>>
<<if _canCraft>>
<!-- Removing ingredients -->
<<for _id, _qty range _recipe.ingredients>>
<<set _item = $playeriteminventory.find(function(item) { return item.name == _id })>>
<<if _item>> <!-- Check to see if item exists -->
<<set _item.quantity -= _qty>>
<<if _item.quantity <= 0>> <!-- If quantity of item is 0, remove it -->
<<set $playeriteminventory = $playeriteminventory.filter(function(item) { return item.name != _id })>>
<</if>>
<</if>>
<</for>>
<!-- Adding result item -->
<<set _existing = $playerpotioninventory.find(function(item) { return item.id == _recipe.result.id })>>
<<if _existing>> <!-- If item already exists, increase quantity -->
<<set _existing.quantity += _recipe.result.quantity>>
<<else>> <!-- If item doesn't exist, create new one -->
<<set _newItem = clone(_recipe.result)>>
<<run $playerpotioninventory.push(_newItem)>>
<</if>>
<!-- Success message -->
<<replace "#craftlog">>You've crafted: <b><<print _recipe.result.name>></b>!<</replace>>
<<else>>
<!-- Message about lack of ingredients -->
<<replace "#craftlog">><span style="color: red;">Not enough ingredients to craft <b><<print _recipe.name>></b>!</span><</replace>>
<</if>>
<</widget>>
basestrength
<<widget "useItem">>\
<<nobr>>
<<if $selectedPotion.quantity gt 0>>
<<set $selectedPotion.quantity to $selectedPotion.quantity - 1>>
/* --- STRENGTH BOOST --- */
<<if $selectedPotion.effect eq "boostStrength">>
<<if $basestrength lt $selectedPotion.maxStatLimit>>
<<set $basestrength to $basestrength + 1>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Strength Increased!</span><br>
Your muscles surge with newfound power. Base Strength is now $basestrength.
</div>
<</replace>>
<<else>>
<<replace "#use-log">>
<div class="use-log warning">
Your strength has reached the limit of this pill's efficacy ($selectedPotion.maxStatLimit). No further boost applied.
</div>
<</replace>>
<</if>>
/* --- HEART DEMON NECTAR --- */
<<elseif $selectedPotion.effect eq "raiseCorruption">>
<<set $corruption to ($corruption || 0) + 2>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text demonic">Demonic Essence Absorbed!</span><br>
The sweet nectar burns your throat. Your inhibitions crumble as the Heart Demon whispers in your ear.
Corruption: $corruption.
</div>
<</replace>>
/* --- SUCCUBUS BREATH MIST --- */
<<elseif $selectedPotion.effect eq "boostCharisma">>
<<if $basecharisma lt $selectedPotion.maxStatLimit>>
<<set $basecharisma to $basecharisma + 1>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Aura of Seduction!</span><br>
Your voice takes on a rhythmic, hypnotic quality. Others find it harder to look away.
Base Charisma: $basecharisma.
</div>
<</replace>>
<<else>>
<<replace "#use-log">>
<div class="use-log warning">
Your mortal vessel cannot contain more charm; the mist dissipates without effect.
</div>
<</replace>>
<</if>>
/* --- FORBIDDEN YANG SEED --- */
<<elseif $selectedPotion.effect eq "deepCorruption">>
<<set $corruption to ($corruption || 0) + 10>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text demonic">Yang Core Awakening!</span><br>
A violent surge of primal energy explodes in your dantian. Dark patterns flicker under your skin.
Corruption has surged to $corruption.
</div>
<</replace>>
<</if>>
<<else>>
/* --- OUT OF ITEMS --- */
<<replace "#use-log">>
<div class="use-log failure">
<span class="glow-text warning">Meridians remain still...</span><br>
You reach for the pill, but find only an empty jade bottle.
</div>
<</replace>>
<</if>>
<</nobr>>\
<</widget>>
<<widget "LootAfterBattle">>
to-do
<</widget>><<set $playernameList to ["Lianhua", "Meiying", "Ziyan", "Xue'er", "Ruyue", "Yuelian", "Qingxue", "Feiyan", "Huixin", "Ling'er", "Zhilan", "Yunxi", "Shuang", "Yanyan", "Mingyue"]>>
<<set $playersurnameList to ["Bai", "Li", "Feng", "Zhao", "Qin", "Shangguan", "Xu", "Jiang", "Mo", "Yan", "Zhu", "Lan", "Tang", "Luo", "Su"]>>
<<set $internalOptions to ["Selfless", "Upstanding", "Kind", "Wicked", "Selfish", "Evil"]>>
<<set $internalTrait to "">>
<<set $externalOptions to ["Romantic", "Vengeful", "Power-hungry", "Loyal", "Family-oriented", "Carefree", "Glory hound", "Self centered"]>>
<<set $externalTrait to "">>
<<set $NPCinternalOptions to ["Selfless", "Upstanding", "Kind", "Wicked", "Selfish", "Evil"]>>
<<set $NPCexternalOptions to ["Romantic", "Vengeful", "Power-hungry", "Loyal", "Family-oriented", "Carefree", "Glory hound", "Self centered"]>>/* PLAYER TREE (Also patched for safety) */
<<widget "DrawPlayerTree">>
<<set _rel to $playerRelations>>
<div class="scroll-tree player-tree">
<div class="tree-row">
<<if (_rel.masters || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Master<<if _rel.masters.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.masters>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
<<if (_rel.parents || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Parents</div>
<div class="card-container">
<<for _id range _rel.parents>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<div class="tree-row">
<<if (_rel.exes || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Exes</div>
<div class="card-container">
<<for _id range _rel.exes>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
<<if (_rel.spouses || []).length gt 0 or (_rel.lovers || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Partners</div>
<div class="card-container">
<<for _id range (_rel.spouses || [])>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r "Spouse">><</if>>
<</for>>
<<for _id range (_rel.lovers || [])>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r "Lover">><</if>>
<</for>>
</div>
</div>
<</if>>
<div class="npc-mini-card focus player-focus" style="border: 2px solid #ffd700; background: #222;">
<div style="font-weight:bold; color:#ffd700; padding: 5px;">
★ <<if $player and $player.name>><<= $player.name>><<else>>You<</if>> ★
</div>
<div style="font-size:0.75em; color:#ddd;">(Player)</div>
</div>
<<if (_rel.siblings || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Sibling<<if _rel.siblings.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.siblings>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
<<if (_rel.rivals || []).length gt 0>>
<div class="relation-group">
<div class="relation-label" style="color: #ff4444;">Rivals</div>
<div class="card-container">
<<for _id range _rel.rivals>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<div class="tree-row">
<<if (_rel.children || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Children</div>
<div class="card-container">
<<for _id range _rel.children>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
<<if (_rel.apprentices || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Apprentice<<if _rel.apprentices.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.apprentices>>
<<set _r to $known_npc_list.find(n => n.id === _id) || ($encounterBatch ? $encounterBatch[_id] : null)>>
<<if _r>><<PlayerTreeCard _r>><</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<<if Object.values(_rel).every(arr => !arr || arr.length === 0)>>
<div style="text-align:center; padding:40px; color:#819ca9; font-style:italic;">
You walk this world alone... for now.
</div>
<</if>>
</div>
<</widget>>
/* Adapted MiniCard specific to the Player Tree */
<<widget "PlayerTreeCard">>
<<set _npc to $args[0]>>
<<set _tag to $args[1]>>
<div @class="'npc-mini-card' + (_npc.isDead ? ' dead-npc' : '')">
<span class="treegrid">@@.link-brown;
<<capture _npc>>
<<link _npc.fullname "RelationsDetailed">>
<<set $selectedNPCid to _npc.id>>
<img @src="'images/' + _npc.enemyregion + '/' + _npc.enemyimage + '.jpg'">
<</link>>
<</capture>>
@@</span>
<<if _tag>>
<div style="font-size: 0.7em; color: #a9819c; margin-top: 2px;"><<= _tag>></div>
<</if>>
</div>
<</widget>>
<<widget "startStatChanges">>
/* Initialize collector for this passage */
<<set $tempStatChanges to []>>
<<set $tempExpGain to 0>>
<<set $tempBreakthroughReady to false>>
<</widget>>
<<widget "gainExp">>
<<set _min to $args[0]>>
<<set _max to $args[1]>>
<<if _max neq undefined>>
<<set _gain to random(_min, _max)>>
<<else>>
<<set _gain to _min>>
<</if>>
<<set _realms = ["Mortal","Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set _stages = ["Early", "Middle", "Late"]>>
<<set _realmIndex = _realms.indexOf($cultivationRealm)>>
<<set _stageIndex = _stages.indexOf($cultivationStage)>>
<<set _baseExp = 1000>>
<<set _requiredExp = _baseExp * Math.pow(_realmIndex + 1, 2) * (_stageIndex + 1)>>
/* Apply exp gain */
<<set $exp += _gain>>
/* Store for grouped display */
<<set $tempExpGain += _gain>>
/* Check if breakthrough is possible */
<<if $exp gte _requiredExp>>
<<set $tempBreakthroughReady to true>>
<</if>>
<</widget>>
<<widget "gainStat">>
<<set _mainVar to $args[0]>>
<<set _comp to $args[1]>>
<<set _min to $args[2]>>
<<set _max to $args[3]>>
<<set _cap to $args[4]>>
<<set _label to ($args[5] ? $args[5] : _mainVar)>>
<<if _cap neq undefined and State.variables[_mainVar] gte _cap>>
<<run $tempStatChanges.push({label: _label, amount: 0, type: "capped"})>>
<<else>>
<<if _max neq undefined and _max neq 0>>
<<set _final to random(_min, _max)>>
<<else>>
<<set _final to _min>>
<</if>>
<<set State.variables[_comp] += _final>>
<<StatsUpdater>>
<<run $tempStatChanges.push({label: _label, amount: _final, type: (_final > 0 ? "gain" : "loss")})>>
<</if>>
<</widget>>
<<widget "loseStat">>
<<set _mainVar to $args[0]>>
<<set _comp to $args[1]>>
<<set _min to $args[2]>>
<<set _max to $args[3]>>
<<set _cap to $args[4]>>
<<set _label to ($args[5] ? $args[5] : _mainVar)>>
<<if _cap neq undefined and State.variables[_mainVar] gte _cap>>
<<run $tempStatChanges.push({label: _label, amount: 0, type: "capped"})>>
<<else>>
<<if _max neq undefined and _max neq 0>>
<<set _final to random(_min, _max)>>
<<else>>
<<set _final to _min>>
<</if>>
<<set State.variables[_comp] -= _final>>
<<StatsUpdater>>
<<run $tempStatChanges.push({label: _label, amount: _final, type: (_final > 0 ? "gain" : "loss")})>>
<</if>>
<</widget>>
<<widget "showStatChanges">>
<div class="stat-changes-container">
/* Show EXP gain if any */
<<if $tempExpGain gt 0>>
<span class="stat-exp">+ $tempExpGain EXP</span>
<<if $tempStatChanges.length gt 0>>
<span class="stat-separator">|</span>
<</if>>
<</if>>
/* Show all stat changes */
<<for _i to 0; _i < $tempStatChanges.length; _i++>>
<<set _change to $tempStatChanges[_i]>>
<<if _change.type eq "gain">>
<span class="stat-gain">+ _change.amount _change.label</span>
<<elseif _change.type eq "loss">>
<span class="stat-loss">- Math.abs(_change.amount) _change.label</span>
<<else>>
<span class="stat-capped">_change.label</span>
<</if>>
<<if _i < $tempStatChanges.length - 1>>
<span class="stat-separator">|</span>
<</if>>
<</for>>
</div>
/* Breakthrough notification (separate, more prominent) */
<<if $tempBreakthroughReady>>
<div class="breakthrough-alert">
⚡ **Your cultivation base is trembling. You are ready for a breakthrough!**
</div>
<</if>>
/* Reset for next passage */
<<set $tempStatChanges to []>>
<<set $tempExpGain to 0>>
<<set $tempBreakthroughReady to false>>
<</widget>><<widget "NpcTalk">>
<<if $currentNPC.friendship lt 20 and $currentNPC.talk lt 3>>
<<set _random_desc_1 = $neutralTalkNPC.pluck()>>
_random_desc_1
<<set $neutralTalkNPC to [
"You look like a new face around here.",
"Not many travelers pass through this area.",
"What brings you to this place?",
"Be careful. Not all cultivators are as kind as they appear.",
"The spiritual energy feels dense today, doesn't it?"
]>>
<</if>>
<<if $currentNPC.friendship gte 30 and $currentNPC.friendship lt 70>>
<<set _random_desc_1 = $friendlyTalkNPC.pluck()>>
_random_desc_1
<<set $friendlyTalkNPC to [
"It’s always good to see a friendly face.",
"Training hard again? You never take a break.",
"I found a quiet spot by the waterfall—you’d love it.",
"Let me know if you ever need help with your cultivation.",
"The sect's been talking about your progress. You're not bad."
]>>
<</if>>
<<if $currentNPC.relationshipType eq "lover" and $currentNPC.hadSex eq 1>>
<<set _random_desc_1 = $loverTalkNPC.pluck()>>
_random_desc_1
<<set $loverTalkNPC to [
"I dreamed of you last night…",
"Come closer. I want to feel your presence.",
"You always make my heart feel lighter.",
"After everything, I’m glad we met.",
"When this world turns to chaos, remember you have me."
]>>
<</if>>
<<if $currentNPC.depravity gt 70>>
<<set _random_desc_1 = $highDepravityTalkNPC.pluck()>>
_random_desc_1
<<set $highDepravityTalkNPC to [
"Power is the only language worth speaking.",
"Desire isn't a weakness—it's fuel.",
"Have you ever killed someone and felt… exhilarated?",
"Kindness? That's a lie we tell ourselves.",
"I could show you things you'd never forget… if you're brave enough."
]>>
<</if>>
<<if $currentNPC.mentorshipType eq 1>>
<<set _random_desc_1 = $MentorTalkNPC.pluck()>>
_random_desc_1
<<set $MentorTalkNPC to [
"Your stance is improving. Slightly.",
"Discipline, focus, and patience—that’s the path.",
"Did you review the techniques I assigned?",
"Even a spark can become a flame. Don’t waste your potential.",
"I was once like you… hungry for power, blind to the cost."
]>>
<</if>>
<<if $currentNPC.mentorshipType eq 2>>
<<set _random_desc_1 = $ApprenticeTalkNPC.pluck()>>
_random_desc_1
<<set $ApprenticeTalkNPC to [
"Master, do you think I’m ready for the next realm?",
"I tried the technique you showed me, but something feels off.",
"Thank you for taking me in. I won’t disappoint you.",
"Sometimes I wonder why you chose me.",
"Your teachings… they saved me more than once."
]>>
<</if>>
<<if $currentNPC.relationshipType eq "enemy">>
<<set _random_desc_1 = $enemyTalkNPC.pluck()>>
_random_desc_1
<<set $enemyTalkNPC to [
"Still alive? Disappointing.",
"One day, I’ll surpass you. Count on it.",
"Don’t think I’ve forgotten what you did.",
"You may have power, but you lack honor.",
"Every time we speak, I lose more respect for you."
]>>
<</if>>
<<if $currentNPC.talk gt 10>>
<<set _random_desc_1 = $highTalk.pluck()>>
_random_desc_1
<<set $highTalk to [
"You’ve changed since we first met.",
"Talking to you always makes things clearer.",
"Strange… I never thought I’d trust someone like you.",
"So much has happened, hasn’t it?",
"Even in silence, your presence comforts me."
]>>
<</if>>
<</widget>><<set $playerJuniorSexBeg to [
"Please… touch me. I need it so badly.",
"Don’t tease me anymore… I’ll do anything.",
"I want it—your hands, your mouth—just *please*…",
"Make me yours. I can’t wait anymore…",
"Please, Junior… I’m aching for you.",
"I’ll be good. Just touch me, please.",
"You win… Just don’t stop now.",
"I’m all yours—just take me already.",
"I need you. Right here. Right now."
]>>
<<set $submissiveDialogueNPC to [
"Ah—fuck, you’re so tight, I can barely handle it…",
"Please… don’t stop… I need it, I need all of you—",
"Senior, I’ll do anything—just don’t stop using me like this—",
"Gods, you’re milking me so good… I can’t think—",
"I’ll cum if you keep going like that—please, not yet—",
"Your pussy’s squeezing me so hard—I can’t last like this, fuck…"
]>>
<<set $dominantDialogueNPC to [
"Take it. Every inch—I want you stuffed full of me.",
"You’re dripping for me. You were made for this cock, weren’t you?",
"So needy, so fucking wet—I could do this all day.",
"Look at you. Fucked dumb on just my cock.",
"I’ll ruin you for anyone else—no one will ever fill you like I do.",
"Keep moaning like that and I’ll make you scream my name, slut."
]>>
<<set $neutralDialogueNPC to [
"Gods, you feel incredible… so warm, so tight…",
"Every time I slide in, it’s like the first time.",
"You fit me perfectly—I never want to stop.",
"Your pussy’s so good… I could lose myself in you.",
"I love watching your face when I push inside.",
"You're amazing… fuck, don’t stop clenching like that…"
]>>
<<set $submissiveDialoguePC to [
"Yes—please, keep going, don’t stop—",
"You’re so deep… gods, I can’t take much more—",
"I’m yours—just fuck me however you want—",
"Ah—ah! You’re stretching me so good—",
"Harder—please, just a little more, I can take it—",
"I love it when you take control—use me—"
]>>
<<set $dominantDialoguePC to [
"You like being inside me, don’t you? Pathetic.",
"This pussy owns you now. Say it.",
"You’ll cum when I say so. Not a moment sooner.",
"Beg for it. Beg to stay inside me.",
"Keep moaning—I want to hear how desperate you are.",
"You're lucky I'm letting you fuck me at all."
]>>
<<set $neutralDialoguePC to [
"Yes… right there… gods, that feels so good—",
"Don’t stop, you feel perfect inside me—",
"Deeper… fuck, that’s it—",
"I want to feel every inch… don’t hold back—",
"You’re hitting all the right spots—don’t stop now—",
"So good… I could fuck you like this forever—"
]>>
__________________________________________________________________________________________
_________________________ARROGANT YOUNG MASTER__________________________________
__________________________________________________________________________________________
<<set $vagDoggyArrogantYMdesc = [
"He fucks you hard — hands gripping your hips, teeth at your neck, hips slamming into you with practiced cruelty. Every thrust is punctuated by some mocking praise.",
"His cock drives deep from behind, your ass slapping against his hips with every punishing thrust. He uses you like a toy, panting with pleasure as he dominates you.",
"You feel completely exposed as he takes you from behind, one hand on your neck and the other spanking your ass between thrusts. There's no gentleness — just raw, possessive force.",
"He grabs your hair and pulls you back as he thrusts deeper. Your cries only make him grin harder — you’re being claimed, over and over again.",
"Bent over with your face pressed to the bedding, you can only moan as he ruts into you like a beast in heat. He fucks like he owns you, and in this moment, maybe he does."
]>>
<<set $vagArrogantYMtalks = [
"You moan like a whore.",
"Maybe I’ll keep you here. You’d look perfect leashed beneath my desk.",
"I knew you’d be good on all fours.",
"You're dripping like a bitch in heat. Don't pretend you're not loving this.",
"Say thank you, slut — thank me for fucking you.",
"No one's going to fuck you like this again. I ruin everything I use.",
"You're not even trying to resist anymore. Good. Know your place.",
"Do you like being used by someone above your station?"
]>>
<<set $vagArrogantYMcumCreampie = [
"With a final, brutal thrust, he buries himself deep — your walls clamp around him just as hot spurts of cum flood your pussy. He grunts, grinding in to make sure it all stays inside.",
"He slams in and holds you tight, cock twitching as he fills you. Warm, thick seed spills deep, and he sighs in satisfaction like he just claimed a prize.",
"You feel his cock throb deep inside, and then the hot rush of release. His cum leaks from you almost instantly, but he stays buried, as if daring it to escape.",
"His rhythm falters, then stops — and he groans low as he spills into you. You can feel every pulse, every drop marking you from the inside.",
"He fucks you straight through his climax, pumping cum into you with each lingering thrust. It’s messy, filthy, and he clearly loves it that way."
]>>
<<set $vagArrogantYMcumTalkCreampie = [
"That's where you belong — dripping full of me.",
"Hope you weren’t planning on using that hole for anyone else.",
"Mmm. You feel better wrapped around my cock than anyone else has.",
"I’ll leave it in for a while — wouldn’t want it leaking out too soon.",
"Consider yourself claimed. You’ll be smelling like me for days."
]>>
<<set $ArrogantYMcumMouth = [
"He shoves your head down, groaning as he cums. Hot, bitter seed hits the back of your throat in thick spurts, and he doesn’t let you up until you’ve swallowed every drop.",
"His cock pulses against your tongue as he fills your mouth. You can’t help but gag slightly, but he just grins and tells you to keep going — to take it all.",
"He moans low and steady, holding your head tight as he cums directly into your mouth. You’re left with no choice but to swallow or choke.",
"Warm cum floods your mouth as he finishes, and you can taste every humiliating drop. He pulls out slow and wipes the tip against your lips.",
"He cums hard, and you feel it fill your mouth almost instantly. It drips down your chin as he laughs and wipes the excess across your cheek."
]>>
<<set $vagArrogantYMcumTalkMouth = [
"Swallow it all. Don’t waste a drop.",
"Good whore. Maybe I’ll let you taste it again sometime.",
"You make a decent cumdump, I’ll give you that.",
"Open wider next time. I want to see it pool on your tongue.",
"Keep your mouth open. I’m not done using it."
]>>
<<set $ArrogantYMcumFace = [
"He jerks himself fast, then tilts your chin up — hot ropes of cum splash across your cheeks, lips, and nose. You feel it drip as he smirks.",
"With a low grunt, he strokes out thick spurts that land across your face — some hitting your forehead, others your lips. You’re painted in disgrace.",
"His cock twitches in his grip, then he releases — warm cum hitting your face in wet splashes, some getting in your hair. He looks proud of the mess.",
"You close your eyes just in time. Cum streaks across your face, running down your jaw and onto your collarbone. He chuckles and calls it an improvement.",
"He holds your face steady, aiming every pulse of cum directly onto your features. You're left dripping, sticky, and humiliated — just how he likes it."
]>>
<<set $vagArrogantYMcumTalkFace = [
"Now that’s a good look for you. So fucking pretty like this.",
"Smile for me. Let everyone see how I decorated you.",
"Stay still. I want to admire my work.",
"That’s what your face is good for — catching my cum.",
"Wipe it off? No. Walk around like that. Let them know."
]>>
<<set $vagCowgirlArrogantYMdesc = [
"He pulls you into his lap, your back to his chest, and forces you down onto his cock, letting you ride him like a toy built for his pleasure.",
"His hand cracks down on your ass, sharp and loud, leaving a red mark that stings with each bounce.",
"You feel his cock throb deep inside as he guides your hips, fucking you from beneath while you moan helplessly."
]>>
<<set $vagArrogantYMtalks = [
"Louder. I want everyone outside to hear what a good whore you are.",
"You ride like you've done this before — don't lie to me.",
"That ass will carry my handprint for days. Perfect.",
"I could sit here all night and let you fuck yourself stupid on my cock."
]>>
<<set $analProneArrogantYMdesc = [
"He shoves your face down into the cushion, lifting your hips and exposing your hole before pushing inside slowly, stretching you open inch by inch.",
"Each thrust is hard and deep, his hips smacking against your ass while your moans are muffled in the fabric beneath you.",
"He leans over your back, breathing hotly into your ear as he pounds into your ass like he owns it."
]>>
<<set $analArrogantYMtalks = [
"Face down, ass up — just how I like my pets.",
"You’ll feel this every time you sit, and you’ll remember who did it to you.",
"Even your tight little hole can't resist me.",
"You're nothing but a hole for my pleasure now. Accept it."
]>>
<!-- Alchemy Vendor -->
<<set $azureCauldronChat = [
"The finest elixirs demand the purest flame and the rarest herbs—patience is the true ingredient of immortality.",
"This Qi Gathering Pill was refined under three full moons; one swallow, and your meridians will sing with power.",
"Beware cheap pills from wandering peddlers—their impurities will clog your dantian like mud in a river.",
"A true alchemist does not chase breakthroughs; he coaxes them, gently, like courting a shy spirit beast.",
"Bring me fresh Spirit Ginseng and Crimson Lotus petals, and I shall brew something worthy of your destiny."
]>>
<!-- Weapon Vendor -->
<<set $thunderClapChat = [
"A sword is merely iron until it drinks the blood of its wielder's resolve—choose your blade wisely.",
"This Heavenly Edge was forged in thunder-fire; it hungers for the heavens themselves.",
"Sharpness alone is not enough—a true weapon must resonate with its master's qi, or it is just cold steel.",
"Your stance tells me you favor swift strikes; this Willow-Leaf Saber would dance in your hands like wind through leaves.",
"Bring me the core of a Core Formation beast, and I will reforge your weapon into something legends fear."
]>>
<!-- Shady NSFW Vendor -->
<<set $blissFurnaceChat = [
"Desire is the purest furnace—let it burn away your inhibitions, and your qi will flow freer than ever.",
"A single drop of Phoenix Tears Oil on sensitive skin… and even the sternest cultivator melts into blissful surrender.",
"True dual cultivation begins with trust; relax your body, open your meridians, and let pleasure guide the energy.",
"This jade rod hums with warm yang qi—used properly, it will temper your foundation in ways no ordinary pill ever could.",
"Come to the back when you're ready; Mei Ling's hands know exactly where your tension hides… and how to release it."
]>>
<<set $playerSexLinesCorrupt to [
"Ahh~ Master, harder!",
"Fuck me until I break...",
"Use me like your whore!",
"I'm your cum dump~",
"Fill my slutty hole!",
"Destroy me, please...",
"I need it rough!",
"Make me scream your name!"
]>>
<<set $playerSexLinesNormal to [
"Ahh~",
"Yes—!",
"More... please",
"Harder!",
"Don't stop...",
"Mmmph~",
"Oh heavens...",
"Right there!",
"You're so deep..."
]>>
<<set $playerSexLinesPure to [
"Ah...!",
"It's too much...",
"Be gentle...",
"Mmm...",
"Oh... yes",
"I-I can't...",
"Please be careful...",
"You're... so big"
]>><<set $breakthroughMethod to "">>
Player starts at *Body Tempering Realm* *Early*
<--Body Tempering Realm to Meridian Awakening Realm -->
*Mortal Path*
Items needed : One Earthly Treasure
*Earthly Path*
Items needed : Three Earthly Treasure
*Heavenly Path*
Items needed : 6 Earthly Treasure
<<set $azureserpentscale to {"name": "Azure Serpent Scale", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A shimmering scale from an ancient serpent that dwells deep in the misty mountains.", "id": "azureserpentscale"}>>
<<set $moonlitorchidnectar to {"name": "Moonlit Orchid Nectar", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "Collected from a rare orchid that blooms only under the full moon’s light", "id": "moonlitorchidnectar"}>>
<<set $emberheartstone to {"name": "Emberheart Stone", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A fiery gemstone born from volcanic flames, radiating warmth and vitality.", "id": "emberheartstone"}>>
<<set $silentphoenixfeather to {"name": "Silent Phoenix Feather", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A single feather from the elusive phoenix, symbolizing rebirth and perseverance.", "id": "silentphoenixfeather"}>>
<<set $ghostvineroot to {"name": "Ghostvine Root", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The twisted root of a plant growing in haunted forests, infused with mysterious energy.", "id": "ghostvineroot"}>>
<<set $celestialdewdrop to {"name": "Celestial Dewdrop", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A rare drop of dew gathered from the leaves of a divine tree", "id": "celestialdewdrop"}>>
<<set $windqi to {"name": "Wind Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The essence of the restless wind.", "id": "windqi"}>>
<<set $flameqi to {"name": "Flame Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The blazing essence of fire.", "id": "flameqi"}>>
<<set $stormqi to {"name": "Storm Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "Charged with the crackling energy of lightning.", "id": "stormqi"}>>
<<set $spiritqi to {"name": "Spirit Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A pure, refined Qi that heightens awareness and focus.", "id": "spiritqi"}>>
<<set $earthqi to {"name": "Earth Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The grounding energy of the earth.", "id": "earthqi"}>>
<<set $frostqi to {"name": "Frost Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The frozing essence of ice", "id": "frostqi"}>><<widget "MainMissionStart">>
<<if $mainStageStarted eq "false">>
<<set _chance to (0,100)>>
<<if _chance gt 50>>
As you move through the dense forest on the map, something unusual catches your eye. A faint glow pulses from behind a cluster of ancient rocks nearby.
Do you want to investigate?
<<link "Yes" "MainMissionStart">><<set $pe to 0>><</link>>
<</if>>
<</if>>
<</widget>>
<<widget "MainMissionStage1">>
<</if>>
<</if>>
<</widget>><<if $pe eq 1>>
<<GenerateFamilyBatch>>
<<set _enemy = $encounterBatch[$encounterMainID]>>
<p>A youth smirks at you. He wears the crest of the <b>_enemy.surname Clan</b>.</p>
<<link "Add this arrogant fool and his family to your Book of Connections">>
/* Safely move them from the temporary batch to your permanent list */
<<for _id, _npcObject range $encounterBatch>>
/* Assuming $known_npc_list is an array of objects.
Even better would be making it an Object/Dictionary! */
<<run $known_npc_list.push(_npcObject)>>
<</for>>
<<replace "#result">><span class="gold">Added to your records!</span><</replace>>
<</link>>
<div id="result"></div>
<<link "go back">><<goto "Map|Region1">><</link>>
<</if>>